aboutsummaryrefslogtreecommitdiffstats
path: root/ext/tk/lib/tkextlib/iwidgets
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-11 04:51:21 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-11 04:51:21 +0000
commit3514110b89bee5c37e308b4ca887e66dfe841456 (patch)
treed280d8542cc44d1cd1a75e8ec87b1f9d231561b7 /ext/tk/lib/tkextlib/iwidgets
parent05f5928c9d0f094d1e7e21a9bd9d8a8fc2f1a805 (diff)
downloadruby-3514110b89bee5c37e308b4ca887e66dfe841456.tar.gz
* ext/tk/lib/tk/*: untabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib/iwidgets')
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/calendar.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/entryfield.rb16
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hierarchy.rb34
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/menubar.rb50
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/notebook.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb12
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb346
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spinner.rb16
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/toolbar.rb2
9 files changed, 240 insertions, 240 deletions
diff --git a/ext/tk/lib/tkextlib/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
index dab10b118b..f382cfd143 100644
--- a/ext/tk/lib/tkextlib/iwidgets/calendar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
@@ -30,7 +30,7 @@ class Tk::Iwidgets::Calendar
_setup_subst_table(KEY_TBL, PROC_TBL);
def self.ret_val(val)
- val
+ val
end
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
index 300573bcec..ae7d63f3f3 100644
--- a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
@@ -26,16 +26,16 @@ class Tk::Iwidgets::Entryfield
#class CalCmdArgs < TkUtil::CallbackSubst
class ValidateArgs < TkUtil::CallbackSubst
KEY_TBL = [
- [ ?c, ?s, :char ],
- [ ?P, ?s, :post ],
- [ ?S, ?s, :current ],
- [ ?W, ?w, :widget ],
- nil
+ [ ?c, ?s, :char ],
+ [ ?P, ?s, :post ],
+ [ ?S, ?s, :current ],
+ [ ?W, ?w, :widget ],
+ nil
]
PROC_TBL = [
- [ ?s, TkComm.method(:string) ],
- [ ?w, TkComm.method(:window) ],
- nil
+ [ ?s, TkComm.method(:string) ],
+ [ ?w, TkComm.method(:window) ],
+ nil
]
_setup_subst_table(KEY_TBL, PROC_TBL);
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
index a7024356ac..077d84c7a4 100644
--- a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
@@ -33,7 +33,7 @@ class Tk::Iwidgets::Hierarchy
_setup_subst_table(KEY_TBL, PROC_TBL);
def self.ret_val(val)
- val
+ val
end
end
@@ -46,21 +46,21 @@ class Tk::Iwidgets::Hierarchy
class IndicatorCommand < TkValidateCommand
class ValidateArgs < TkUtil::CallbackSubst
KEY_TBL = [
- [ ?n, ?s, :node ],
- [ ?s, ?b, :status ],
- nil
+ [ ?n, ?s, :node ],
+ [ ?s, ?b, :status ],
+ nil
]
PROC_TBL = [
- [ ?s, TkComm.method(:string) ],
- [ ?b, TkComm.method(:bool) ],
- nil
+ [ ?s, TkComm.method(:string) ],
+ [ ?b, TkComm.method(:bool) ],
+ nil
]
_setup_subst_table(KEY_TBL, PROC_TBL);
def self.ret_val(val)
- val
+ val
end
end
@@ -73,15 +73,15 @@ class Tk::Iwidgets::Hierarchy
class IconCommand < TkValidateCommand
class ValidateArgs < TkUtil::CallbackSubst
KEY_TBL = [
- [ ?n, ?s, :node ],
- [ ?i, ?s, :icon ],
- nil
+ [ ?n, ?s, :node ],
+ [ ?i, ?s, :icon ],
+ nil
]
PROC_TBL = [ [ ?s, TkComm.method(:string) ], nil ]
_setup_subst_table(KEY_TBL, PROC_TBL);
def self.ret_val(val)
- val
+ val
end
end
@@ -200,7 +200,7 @@ class Tk::Iwidgets::Hierarchy
def compare(idx1, op, idx2)
bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1),
- op, _get_eval_enc_str(idx2)))
+ op, _get_eval_enc_str(idx2)))
end
def debug
@@ -234,16 +234,16 @@ class Tk::Iwidgets::Hierarchy
# multiple chars-taglist argument :: str, [tag,...], str, [tag,...], ...
args = [chars]
while tags.size > 0
- args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist
- args << tags.shift if tags.size > 0 # chars
+ args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist
+ args << tags.shift if tags.size > 0 # chars
end
super index, *args
else
# single chars-taglist argument :: str, tag, tag, ...
if tags.size == 0
- super index, chars
+ super index, chars
else
- super index, chars, tags.collect{|x|_get_eval_string(x)}.join(' ')
+ super index, chars, tags.collect{|x|_get_eval_string(x)}.join(' ')
end
end
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/menubar.rb b/ext/tk/lib/tkextlib/iwidgets/menubar.rb
index b4c94ff564..b60349be17 100644
--- a/ext/tk/lib/tkextlib/iwidgets/menubar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/menubar.rb
@@ -70,41 +70,41 @@ class Tk::Iwidgets::Menubar
next unless spec
if spec.kind_of?(Hash)
- args = [spec]
- type = 'options'
+ args = [spec]
+ type = 'options'
else
- type, *args = spec
+ type, *args = spec
end
type = type.to_s
case type
when 'options'
- keys = args[0]
- ary = [type]
- ary.concat(hash_kv(keys))
- ret << array2tk_list(ary) << "\n"
+ keys = args[0]
+ ary = [type]
+ ary.concat(hash_kv(keys))
+ ret << array2tk_list(ary) << "\n"
when 'menubutton', 'cascade'
- name, keys = args
- if keys
- ary = [type, name]
- keys = _symbolkey2str(keys)
- keys['menu'] = _parse_menu_spec(keys['menu']) if keys.key?('menu')
- ary.concat(hash_kv(keys))
- ret << array2tk_list(ary) << "\n"
- else
- ret << array2tk_list([type, name]) << "\n"
- end
+ name, keys = args
+ if keys
+ ary = [type, name]
+ keys = _symbolkey2str(keys)
+ keys['menu'] = _parse_menu_spec(keys['menu']) if keys.key?('menu')
+ ary.concat(hash_kv(keys))
+ ret << array2tk_list(ary) << "\n"
+ else
+ ret << array2tk_list([type, name]) << "\n"
+ end
else
- name, keys = args
- if keys
- ary = [type, name]
- ary.concat(hash_kv(keys))
- ret << array2tk_list(ary) << "\n"
- else
- ret << array2tk_list([type, name]) << "\n"
- end
+ name, keys = args
+ if keys
+ ary = [type, name]
+ ary.concat(hash_kv(keys))
+ ret << array2tk_list(ary) << "\n"
+ else
+ ret << array2tk_list([type, name]) << "\n"
+ end
end
}
ret
diff --git a/ext/tk/lib/tkextlib/iwidgets/notebook.rb b/ext/tk/lib/tkextlib/iwidgets/notebook.rb
index 511ee3dff3..d9abf1b02b 100644
--- a/ext/tk/lib/tkextlib/iwidgets/notebook.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/notebook.rb
@@ -72,7 +72,7 @@ class Tk::Iwidgets::Notebook
end
if idx2
if (new_idx2 = self.index(idx2)) < 0
- new_idx2 = tagid(idx2)
+ new_idx2 = tagid(idx2)
end
tk_call(@path, 'delete', new_idx1, new_idx2)
else
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
index c5ed19c1f1..c26eda1586 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
@@ -94,7 +94,7 @@ class Tk::Iwidgets::Scrolledcanvas
def bbox(tagOrId, *tags)
list(tk_send_without_enc('bbox', tagid(tagOrId),
- *tags.collect{|t| tagid(t)}))
+ *tags.collect{|t| tagid(t)}))
end
def itembind(tag, context, cmd=Proc.new, args=nil)
@@ -136,14 +136,14 @@ class Tk::Iwidgets::Scrolledcanvas
def dchars(tag, first, last=None)
tk_send_without_enc('dchars', tagid(tag),
- _get_eval_enc_str(first), _get_eval_enc_str(last))
+ _get_eval_enc_str(first), _get_eval_enc_str(last))
self
end
def delete(*args)
if TkcItem::CItemID_TBL[self.path]
find('withtag', *args).each{|item|
- TkcItem::CItemID_TBL[self.path].delete(item.id)
+ TkcItem::CItemID_TBL[self.path].delete(item.id)
}
end
tk_send_without_enc('delete', *args.collect{|t| tagid(t)})
@@ -190,9 +190,9 @@ class Tk::Iwidgets::Scrolledcanvas
else
ret = tk_send_without_enc('focus')
if ret == ""
- nil
+ nil
else
- TkcItem.id2obj(self, ret)
+ TkcItem.id2obj(self, ret)
end
end
end
@@ -214,7 +214,7 @@ class Tk::Iwidgets::Scrolledcanvas
def insert(tagOrId, index, string)
tk_send_without_enc('insert', tagid(tagOrId), index,
- _get_eval_enc_str(string))
+ _get_eval_enc_str(string))
self
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
index 95d1034f16..39a9ed63c8 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
@@ -77,7 +77,7 @@ class Tk::Iwidgets::Scrolledtext
end
def compare(idx1, op, idx2)
bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1),
- op, _get_eval_enc_str(idx2)))
+ op, _get_eval_enc_str(idx2)))
end
def debug
@@ -110,24 +110,24 @@ class Tk::Iwidgets::Scrolledtext
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
_fromUTF8(tk_send_without_enc('image', 'cget',
- _get_eval_enc_str(index), "-#{slot}"))
+ _get_eval_enc_str(index), "-#{slot}"))
else
tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget',
- _get_eval_enc_str(index),
- "-#{slot}")))
+ _get_eval_enc_str(index),
+ "-#{slot}")))
end
end
def image_configure(index, slot, value=None)
if slot.kind_of? Hash
_fromUTF8(tk_send_without_enc('image', 'configure',
- _get_eval_enc_str(index),
- *hash_kv(slot, true)))
+ _get_eval_enc_str(index),
+ *hash_kv(slot, true)))
else
_fromUTF8(tk_send_without_enc('image', 'configure',
- _get_eval_enc_str(index),
- "-#{slot}",
- _get_eval_enc_str(value)))
+ _get_eval_enc_str(index),
+ "-#{slot}",
+ _get_eval_enc_str(value)))
end
self
end
@@ -135,80 +135,80 @@ class Tk::Iwidgets::Scrolledtext
def image_configinfo(index, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
- case slot.to_s
- when 'text', 'label', 'show', 'data', 'file'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- end
- conf[0] = conf[0][1..-1]
- conf
+ case slot.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
else
- tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist|
- conf = tk_split_simplelist(conflist)
- conf[0] = conf[0][1..-1]
- case conf[0]
- when 'text', 'label', 'show', 'data', 'file'
- else
- if conf[3]
- if conf[3].index('{')
- conf[3] = tk_split_list(conf[3])
- else
- conf[3] = tk_tcl2ruby(conf[3])
- end
- end
- if conf[4]
- if conf[4].index('{')
- conf[4] = tk_split_list(conf[4])
- else
- conf[4] = tk_tcl2ruby(conf[4])
- end
- end
- end
- conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
- conf
- }
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ case conf[0]
+ when 'text', 'label', 'show', 'data', 'file'
+ else
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
- case slot.to_s
- when 'text', 'label', 'show', 'data', 'file'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- end
- key = conf.shift[1..-1]
- { key => conf }
+ case slot.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
else
- ret = {}
- tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist|
- conf = tk_split_simplelist(conflist)
- key = conf.shift[1..-1]
- case key
- when 'text', 'label', 'show', 'data', 'file'
- else
- if conf[2]
- if conf[2].index('{')
- conf[2] = tk_split_list(conf[2])
- else
- conf[2] = tk_tcl2ruby(conf[2])
- end
- end
- if conf[3]
- if conf[3].index('{')
- conf[3] = tk_split_list(conf[3])
- else
- conf[3] = tk_tcl2ruby(conf[3])
- end
- end
- end
- if conf.size == 1
- ret[key] = conf[0][1..-1] # alias info
- else
- ret[key] = conf
- end
- }
- ret
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show', 'data', 'file'
+ else
+ if conf[2]
+ if conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ ret
end
end
end
@@ -216,19 +216,19 @@ class Tk::Iwidgets::Scrolledtext
def current_image_configinfo(index, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
- conf = image_configinfo(index, slot)
- {conf[0] => conf[4]}
+ conf = image_configinfo(index, slot)
+ {conf[0] => conf[4]}
else
- ret = {}
- image_configinfo(index).each{|conf|
- ret[conf[0]] = conf[4] if conf.size > 2
- }
- ret
+ ret = {}
+ image_configinfo(index).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
image_configinfo(index, slot).each{|k, conf|
- ret[k] = conf[-1] if conf.kind_of?(Array)
+ ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
@@ -258,7 +258,7 @@ class Tk::Iwidgets::Scrolledtext
def mark_gravity(mark, direction=nil)
if direction
tk_send_without_enc('mark', 'gravity',
- _get_eval_enc_str(mark), direction)
+ _get_eval_enc_str(mark), direction)
self
else
tk_send_without_enc('mark', 'gravity', _get_eval_enc_str(mark))
@@ -267,27 +267,27 @@ class Tk::Iwidgets::Scrolledtext
def mark_set(mark, index)
tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark),
- _get_eval_enc_str(index))
+ _get_eval_enc_str(index))
self
end
alias set_mark mark_set
def mark_unset(*marks)
tk_send_without_enc('mark', 'unset',
- *(marks.collect{|mark| _get_eval_enc_str(mark)}))
+ *(marks.collect{|mark| _get_eval_enc_str(mark)}))
self
end
alias unset_mark mark_unset
def mark_next(index)
tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next',
- _get_eval_enc_str(index))))
+ _get_eval_enc_str(index))))
end
alias next_mark mark_next
def mark_previous(index)
tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous',
- _get_eval_enc_str(index))))
+ _get_eval_enc_str(index))))
end
alias previous_mark mark_previous
@@ -309,14 +309,14 @@ class Tk::Iwidgets::Scrolledtext
# $KCODE == 'NONE'
if JAPANIZED_TK
tk_call_without_enc('kstring', 'length',
- _get_eval_enc_str(txt)).to_i
+ _get_eval_enc_str(txt)).to_i
else
begin
- tk_call_without_enc('encoding', 'convertto', 'ascii',
- _get_eval_enc_str(txt)).length
+ tk_call_without_enc('encoding', 'convertto', 'ascii',
+ _get_eval_enc_str(txt)).length
rescue StandardError, NameError
- # sorry, I have no plan
- txt.length
+ # sorry, I have no plan
+ txt.length
end
end
end
@@ -368,53 +368,53 @@ class Tk::Iwidgets::Scrolledtext
return ["", 0] if compare(start,'>=',stop)
txt = get(start,stop)
if (pos = txt.index(pat))
- match = $&
- #pos = txt[0..(pos-1)].split('').length if pos > 0
- pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
- #return [index(start + " + #{pos} chars"), pat.split('').length]
- return [index(start + " + #{pos} chars"),
- _ktext_length(pat), pat.dup]
- else
- #return [index(start + " + #{pos} chars"), $&.split('').length]
- return [index(start + " + #{pos} chars"),
- _ktext_length(match), match]
- end
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
+ if pat.kind_of? String
+ #return [index(start + " + #{pos} chars"), pat.split('').length]
+ return [index(start + " + #{pos} chars"),
+ _ktext_length(pat), pat.dup]
+ else
+ #return [index(start + " + #{pos} chars"), $&.split('').length]
+ return [index(start + " + #{pos} chars"),
+ _ktext_length(match), match]
+ end
else
- return ["", 0]
+ return ["", 0]
end
else
txt = get(start,'end - 1 char')
if (pos = txt.index(pat))
- match = $&
- #pos = txt[0..(pos-1)].split('').length if pos > 0
- pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
- #return [index(start + " + #{pos} chars"), pat.split('').length]
- return [index(start + " + #{pos} chars"),
- _ktext_length(pat), pat.dup]
- else
- #return [index(start + " + #{pos} chars"), $&.split('').length]
- return [index(start + " + #{pos} chars"),
- _ktext_length(match), match]
- end
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
+ if pat.kind_of? String
+ #return [index(start + " + #{pos} chars"), pat.split('').length]
+ return [index(start + " + #{pos} chars"),
+ _ktext_length(pat), pat.dup]
+ else
+ #return [index(start + " + #{pos} chars"), $&.split('').length]
+ return [index(start + " + #{pos} chars"),
+ _ktext_length(match), match]
+ end
else
- txt = get('1.0','end - 1 char')
- if (pos = txt.index(pat))
- match = $&
- #pos = txt[0..(pos-1)].split('').length if pos > 0
- pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
- #return [index("1.0 + #{pos} chars"), pat.split('').length]
- return [index("1.0 + #{pos} chars"),
- _ktext_length(pat), pat.dup]
- else
- #return [index("1.0 + #{pos} chars"), $&.split('').length]
- return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
- end
- else
- return ["", 0]
- end
+ txt = get('1.0','end - 1 char')
+ if (pos = txt.index(pat))
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
+ if pat.kind_of? String
+ #return [index("1.0 + #{pos} chars"), pat.split('').length]
+ return [index("1.0 + #{pos} chars"),
+ _ktext_length(pat), pat.dup]
+ else
+ #return [index("1.0 + #{pos} chars"), $&.split('').length]
+ return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
+ end
+ else
+ return ["", 0]
+ end
end
end
end
@@ -429,48 +429,48 @@ class Tk::Iwidgets::Scrolledtext
return ["", 0] if compare(start,'<=',stop)
txt = get(stop,start)
if (pos = txt.rindex(pat))
- match = $&
- #pos = txt[0..(pos-1)].split('').length if pos > 0
- pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
- #return [index(stop + " + #{pos} chars"), pat.split('').length]
- return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
- else
- #return [index(stop + " + #{pos} chars"), $&.split('').length]
- return [index(stop + " + #{pos} chars"), _ktext_length(match), match]
- end
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
+ if pat.kind_of? String
+ #return [index(stop + " + #{pos} chars"), pat.split('').length]
+ return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
+ else
+ #return [index(stop + " + #{pos} chars"), $&.split('').length]
+ return [index(stop + " + #{pos} chars"), _ktext_length(match), match]
+ end
else
- return ["", 0]
+ return ["", 0]
end
else
txt = get('1.0',start)
if (pos = txt.rindex(pat))
- match = $&
- #pos = txt[0..(pos-1)].split('').length if pos > 0
- pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
- #return [index("1.0 + #{pos} chars"), pat.split('').length]
- return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
- else
- #return [index("1.0 + #{pos} chars"), $&.split('').length]
- return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
- end
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
+ if pat.kind_of? String
+ #return [index("1.0 + #{pos} chars"), pat.split('').length]
+ return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
+ else
+ #return [index("1.0 + #{pos} chars"), $&.split('').length]
+ return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
+ end
else
- txt = get('1.0','end - 1 char')
- if (pos = txt.rindex(pat))
- match = $&
- #pos = txt[0..(pos-1)].split('').length if pos > 0
- pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
- #return [index("1.0 + #{pos} chars"), pat.split('').length]
- return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
- else
- #return [index("1.0 + #{pos} chars"), $&.split('').length]
- return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
- end
- else
- return ["", 0]
- end
+ txt = get('1.0','end - 1 char')
+ if (pos = txt.rindex(pat))
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
+ if pat.kind_of? String
+ #return [index("1.0 + #{pos} chars"), pat.split('').length]
+ return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
+ else
+ #return [index("1.0 + #{pos} chars"), $&.split('').length]
+ return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
+ end
+ else
+ return ["", 0]
+ end
end
end
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/spinner.rb b/ext/tk/lib/tkextlib/iwidgets/spinner.rb
index f4f0eb46c8..b5c72b4df8 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spinner.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spinner.rb
@@ -26,16 +26,16 @@ class Tk::Iwidgets::Spinner
#class CalCmdArgs < TkUtil::CallbackSubst
class ValidateArgs < TkUtil::CallbackSubst
KEY_TBL = [
- [ ?c, ?s, :char ],
- [ ?P, ?s, :post ],
- [ ?S, ?s, :current ],
- [ ?W, ?w, :widget ],
- nil
+ [ ?c, ?s, :char ],
+ [ ?P, ?s, :post ],
+ [ ?S, ?s, :current ],
+ [ ?W, ?w, :widget ],
+ nil
]
PROC_TBL = [
- [ ?s, TkComm.method(:string) ],
- [ ?w, TkComm.method(:window) ],
- nil
+ [ ?s, TkComm.method(:string) ],
+ [ ?w, TkComm.method(:window) ],
+ nil
]
_setup_subst_table(KEY_TBL, PROC_TBL);
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb
index fffd5b388c..a2a7f31627 100644
--- a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb
@@ -81,7 +81,7 @@ class Tk::Iwidgets::Toolbar
tag = Tk::Itk::Component.new(self)
end
window(tk_call(@path, 'insert', index(idx), type,
- tagid(tag), *hash_kv(keys)))
+ tagid(tag), *hash_kv(keys)))
tag
end
end