mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/sample/tktextio.rb: add comment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
746268fa1b
commit
6f70f54e1d
1 changed files with 10 additions and 2 deletions
|
@ -1,9 +1,18 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
#
|
#
|
||||||
# sample class of handling I/O stream on a TkText widget
|
# sample class of handling I/O stream on a TkText widget
|
||||||
#
|
|
||||||
# by Hidetoshi NAGAI
|
# by Hidetoshi NAGAI
|
||||||
#
|
#
|
||||||
|
# NOTE: TkTextIO supports 'character' (not 'byte') access only.
|
||||||
|
# So, for example, TkTextIO#getc returns a character, TkTextIO#pos
|
||||||
|
# means the character position, TkTextIO#read(size) counts by
|
||||||
|
# characters, and so on.
|
||||||
|
# Of course, it is available to make TkTextIO class to suuport
|
||||||
|
# 'byte' access. However, it may break multi-byte characters.
|
||||||
|
# and then, displayed string on the text widget may be garbled.
|
||||||
|
# I think that it is not good on the supposed situation of using
|
||||||
|
# TkTextIO.
|
||||||
|
#
|
||||||
require 'tk'
|
require 'tk'
|
||||||
|
|
||||||
class TkTextIO < TkText
|
class TkTextIO < TkText
|
||||||
|
@ -50,7 +59,6 @@ class TkTextIO < TkText
|
||||||
@open[:r] = true; @open[:w] = true
|
@open[:r] = true; @open[:w] = true
|
||||||
@txtpos.set('end - 1 char')
|
@txtpos.set('end - 1 char')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def <<(obj)
|
def <<(obj)
|
||||||
|
|
Loading…
Add table
Reference in a new issue