~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to ext/tk/lib/tk/texttag.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2010-07-31 17:08:39 UTC
  • mfrom: (1.1.4 upstream) (8.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100731170839-j034dmpdqt1cc4p6
Tags: 1.9.2~svn28788-1
* New release based on upstream snapshot from the 1.9.2 branch,
  after 1.9.2 RC2. That branch is (supposed to be) binary-compatible
  with the 1.9.1 branch.
  + Builds fine on i386. Closes: #580852.
* Upgrade to Standards-Version: 3.9.1. No changes needed.
* Updated generated incs.
* Patches that still need work:
  + Unclear status, need more investigation:
   090729_fix_Makefile_deps.dpatch
   090803_exclude_rdoc.dpatch
   203_adjust_base_of_search_path.dpatch
   902_define_YAML_in_yaml_stringio.rb.dpatch
   919_common.mk_tweaks.dpatch
   931_libruby_suffix.dpatch
   940_test_thread_mutex_sync_shorter.dpatch
  + Maybe not needed anymore, keeping but not applying.
   102_skip_test_copy_stream.dpatch (test doesn't block anymore?)
   104_skip_btest_io.dpatch (test doesn't block anymore?)
   201_gem_prelude.dpatch (we don't use that rubygems anyway?)
   202_gem_default_dir.dpatch (we don't use that rubygems anyway?)
   940_test_file_exhaustive_fails_as_root.dpatch
   940_test_priority_fails.dpatch
   100518_load_libc_libm.dpatch
* Add disable-tests.diff: disable some tests that cause failures on FreeBSD.
  Closes: #590002, #543805, #542927.
* However, many new failures on FreeBSD. Since that version is still an
  improvement, add the check that makes test suite failures non-fatal on
  FreeBSD again. That still needs to be investigated.
* Re-add 903_skip_base_ruby_check.dpatch
* Add build-dependency on ruby1.8 and drop all pre-generated files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
  TTagID_TBL = TkCore::INTERP.create_table
13
13
 
14
 
  (Tk_TextTag_ID = ['tag'.freeze, '00000'.taint]).instance_eval{
 
14
  (Tk_TextTag_ID = ['tag'.freeze, TkUtil.untrust('00000')]).instance_eval{
15
15
    @mutex = Mutex.new
16
16
    def mutex; @mutex; end
17
17
    freeze
26
26
    TTagID_TBL.mutex.synchronize{
27
27
      if TTagID_TBL[tpath]
28
28
        TTagID_TBL[tpath][id]? TTagID_TBL[tpath][id]: id
29
 
      else 
 
29
      else
30
30
        id
31
31
      end
32
32
    }
84
84
  end
85
85
 
86
86
  def add(*indices)
87
 
    tk_call_without_enc(@t.path, 'tag', 'add', @id, 
 
87
    tk_call_without_enc(@t.path, 'tag', 'add', @id,
88
88
                        *(indices.collect{|idx| _get_eval_enc_str(idx)}))
89
89
    self
90
90
  end
91
91
 
92
92
  def remove(*indices)
93
 
    tk_call_without_enc(@t.path, 'tag', 'remove', @id, 
 
93
    tk_call_without_enc(@t.path, 'tag', 'remove', @id,
94
94
                        *(indices.collect{|idx| _get_eval_enc_str(idx)}))
95
95
    self
96
96
  end
105
105
  end
106
106
 
107
107
  def nextrange(first, last=None)
108
 
    simplelist(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id, 
109
 
                                   _get_eval_enc_str(first), 
 
108
    simplelist(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id,
 
109
                                   _get_eval_enc_str(first),
110
110
                                   _get_eval_enc_str(last))).collect{|idx|
111
111
      Tk::Text::IndexString.new(idx)
112
112
    }
113
113
  end
114
114
 
115
115
  def prevrange(first, last=None)
116
 
    simplelist(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id, 
117
 
                                   _get_eval_enc_str(first), 
 
116
    simplelist(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id,
 
117
                                   _get_eval_enc_str(first),
118
118
                                   _get_eval_enc_str(last))).collect{|idx|
119
119
      Tk::Text::IndexString.new(idx)
120
120
    }
129
129
    val
130
130
  end
131
131
 
 
132
  def cget_tkstring(key)
 
133
    @t.tag_cget_tkstring @id, key
 
134
  end
132
135
  def cget(key)
133
136
    @t.tag_cget @id, key
134
137
  end
142
145
      _fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', @id, "-#{key}"))
143
146
    when 'font', 'kanjifont'
144
147
      #fnt = tk_tcl2ruby(tk_call(@t.path, 'tag', 'cget', @id, "-#{key}"))
145
 
      fnt = tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', 
 
148
      fnt = tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget',
146
149
                                                      @id, '-font')))
147
150
      unless fnt.kind_of?(TkFont)
148
151
        fnt = tagfontobj(@id, fnt)
154
157
        fnt
155
158
      end
156
159
    else
157
 
      tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', 
 
160
      tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget',
158
161
                                                @id, "-#{key}")))
159
162
    end
160
163
  end
227
230
  end
228
231
 
229
232
  def raise(above=None)
230
 
    tk_call_without_enc(@t.path, 'tag', 'raise', @id, 
 
233
    tk_call_without_enc(@t.path, 'tag', 'raise', @id,
231
234
                        _get_eval_enc_str(above))
232
235
    self
233
236
  end
234
237
 
235
238
  def lower(below=None)
236
 
    tk_call_without_enc(@t.path, 'tag', 'lower', @id, 
 
239
    tk_call_without_enc(@t.path, 'tag', 'lower', @id,
237
240
                        _get_eval_enc_str(below))
238
241
    self
239
242
  end