ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 6日 (木) 11:02:01 JST
------------------------- REMOTE_ADDR = 70.49.49.99 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-itrsmrks ------------------------- @@ -22,6 +22,11 @@ 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. If you wish you can still navigate text buffer this way, though in the case you use UTF-8 character encoding, this can become increasingly unreliable. Should you have a need to do so, you can employ Gtk::TextBuffer#get_iter_at_offset(char_offset), which gets the iter pointer to a position((*char_offset*))bytes (note, not characters) from the start of the entire buffer, and Gtk::TextIter#offset which returns the character offset of an iterator. + +:CAUTION: + The word ((*index*)) refers to an individual byte, you need to be careful when stepping through a text buffer in later examples. In particular you can not refer to an index pointing to the position between two characters. + + {{br}} === Text Marks