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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 16日 (日) 06:12:12 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-itrsmrks
-------------------------
@@ -508,7 +508,22 @@
 
  first, last = start.forward_search(ent.text, Gtk::TextIter::SEARCH_TEXT_ONLY, nil)
 
+
+Note also that((*start*)) iterator is advanced for one character before the forward_search is run inside the while loop.
+
+ start.forward_char
+
+This is a rather profound move since one may conclude that the the very first match should it be at the very beginning of the text buffer would never be found. That is not the case, however, since the Gtk::TextBuffer#start_iter returns the iter at text buffer offset 0 (ZERO), which just like the last position in the text buffer should never be populated with any text.  
+
+ start = first
+
+Similarly, when viewed after the execution of ((*start.forward_char*)) the statement ((*start = first*)) which advances the search to the next match deserves a special attention. Namely, the "start" and "first" iterators after ((*start = first*)) is executed become one and the same iterator. If it were important that the two variables would remain different  ((*start = first.clone*)) should be called instead. 
+
+
+
 Following is a brief summary for this iterator instance method. Pay attention to return values:
+
+
 
 --- Gtk::TextIter#forward_search(str, flags, limit)
     Searches forward for str. Any match is returned by an array of Gtk::TextIter [match_start, match_end]. match_start is set to the first character of the match and match_end to the first character after the match. The search will not continue past limit. If you specify Gtk::TextIter::SEARCH_TEXT_ONLY flag, the match may have pixbufs or child widgets mixed inside the matched range. If these flags are not given, the match must be exact.




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