summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/textwindow.rb
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-17 07:31:51 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-17 07:31:51 +0000
commitcb2349d653e70e77e189ae6ef8b11b26c50b4261 (patch)
tree82ea520263e3492c6eedccba2ab2dfaac161d5fd /ext/tk/lib/tk/textwindow.rb
parent3da93dd84287874fdefe439384efcc3d56d1c07f (diff)
* ext/tk/lib/tk.rb: fix bug on setting up system encoding
* ext/tk/lib/tk/event.rb: fix error on require process * ext/tk/lib/font.rb: fix abnormal termination error on Windows * ext/tk/lib/tk/virtevent.rb: TkVirtualEvent::PreDefVirtEvent.new() accepts event-sequence arguments * ext/tk/lib/text.rb: fail to dump embedded images * ext/tk/lib/text.rb: tag_nextrange and tag_prevrange returns wrong types of values * ext/tk/lib/texttag.rb: nextrange and prevrange returns wrong types of values * ext/tk/lib/text.rb: add TkText::IndexModMethods module and TkText::IndexString class to treat text index modifiers * ext/tk/lib/texttag.rb: use TkText::IndexModMethods module * ext/tk/lib/textmark.rb: ditto * ext/tk/lib/textimage.rb: ditto * ext/tk/lib/textwindow.rb: ditto * ext/tk/lib/textimage.rb: wrong gravity of text mark for embedded image * ext/tk/lib/textwindow.rb: wrong gravity of text mark for embedded window git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk/textwindow.rb')
-rw-r--r--ext/tk/lib/tk/textwindow.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb
index c53cbe1a70..7c97313582 100644
--- a/ext/tk/lib/tk/textwindow.rb
+++ b/ext/tk/lib/tk/textwindow.rb
@@ -5,12 +5,14 @@ require 'tk'
require 'tk/text'
class TkTextWindow<TkObject
- def initialize(parent, index, keys)
+ include TkText::IndexModMethods
+
+ def initialize(parent, index, keys = {})
#unless parent.kind_of?(TkText)
# fail ArguemntError, "expect TkText for 1st argument"
#end
@t = parent
- if index == 'end'
+ if index == 'end' || index == :end
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
'end - 1 chars'))
elsif index.kind_of?(TkTextMark)
@@ -49,6 +51,14 @@ class TkTextWindow<TkObject
end
tk_call_without_enc(@t.path, 'window', 'create', @index,
*hash_kv(keys, true))
+ @path.gravity = 'right'
+ end
+
+ def id
+ TkText::IndexString.new(_epath(@id))
+ end
+ def mark
+ @path
end
def [](slot)