[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-txtw-itrsmrks

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 6日 (木) 10:24:21 JST


-------------------------
REMOTE_ADDR = 70.49.49.99
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-itrsmrks
-------------------------
@@ -10,6 +10,8 @@
     Text iterators represent a position between two characters in a text buffer. If I borrow the terminology from geometry, we can say that text iterators are used to define a single spot (a point) in a text buffer or to define an interval or a contiguous block of text in a text buffer. They are transient or ephemeral in nature, because they become invalid as soon as the text buffer is edited i.e. when text is inserted or deleted in the buffer. Iterators are better than offset or byte index into a buffer, because they are guarantied to point at the beginning of an UTF-8 character, which may be a string of multiple bytes.
 
 
+Sometimes you would like to refer to a position within a text buffer by means of index and offset, which in the early days of programming, before multi-byte characters were introduced, used to be the rather natural way to navigate the buffer. To this end you will employ Gtk::TextBuffer#get_iter_at_offset(char_offset), which gets the iter to a position char_offset chars from the start of the entire buffer,  and Gtk::TextIter#offset which returns the character offset of an iterator.
+
 :Text Marks
 
     For keeping track of the position in a text buffer throughout the editing process Gtk::TextMark object is provided. Text marks remain intact even when text buffer is changed, and will move the position based on how the text buffer is manipulated. You can retrieve an iterator position at a text mark with Gtk::TextBuffer#get_iter_at_mark(mark):




ruby-gnome2-cvs メーリングリストの案内
Back to archive index