GNOME Bugzilla – Bug 114666
Backward search inconsistencies
Last modified: 2011-09-18 09:53:32 UTC
According to Paolo's initial discovery: 1. Open a new document 2. Write 5 lines containing only "hello" 3. Search forward for "lo\nhe" 4. Observe that it matches 5. Search backwards 6. Drool in amazement as nothing happens Something needs to happen, and preliminary investigation has pointed to gedit's search functionality.
Further investigation yields the following: search text and relevant options are identical up until the gtk_source_iter_[forward|backward]_search function gets called. After that, the backward search returns FALSE where the forward search returns TRUE. Which (probably) means that the real answer lies somewhere in the guts of gtk_source_iter_backward_search().
Fixed this in CVS. There are some remaining issues though: a) Multi-line searches now properly work case-insensitive, but don't matching case because that is implemented using gtk_text_iter_backward_search(). The difference is that gtk_source_iter_backward_search() searches from the starting iter and backward, while gtk_text_iter_backward_search() also includes the text from the iter the end of the line in the "haystack". So basically, if you start the search from the start of a match, gtk_text_iter_backward_search() will not move, but gtk_source_iter_backward_search() will. I'm not really sure which is correct. b) If a search can match inside another match, searching backward will show all occurrences, while searching forward will skip the inner matches. Example: for the sample data above (5 lines with the world "hello"), search for "lo\nhello\nhe". Forward will succed two times, while backward will match three times. I'm not sure this should even be considered a bug in GtkSourceView, since the results actually depend on the starting iter. Maybe gedit should move the iter backward by strlen(needle) before attempting to search backwards? I'm leaving the bug open for now, until these two points are cleared.
Changing status to NEEDINFO, so the actual state of the bug is more obvious. Sorry for the spam.
Changing subject to reflect current bug state.
eric, gustavo, any news here? is this obsolete nowadays? if this is still an issue, which version is this about? thanks in advance.
Yes, this is still an open problem.
Let's close this as obsolete afterall. Search is now part of gtk and I see little point in reassigning this bug that would probably lay there untouched for the next several years :)