After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 114666 - Backward search inconsistencies
Backward search inconsistencies
Status: RESOLVED OBSOLETE
Product: gtksourceview
Classification: Platform
Component: General
1.8.x
Other Linux
: Normal minor
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on: 348754
Blocks:
 
 
Reported: 2003-06-07 22:24 UTC by Eric Ritezel
Modified: 2011-09-18 09:53 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6



Description Eric Ritezel 2003-06-07 22:24:28 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.
Comment 1 Eric Ritezel 2003-06-08 01:17:54 UTC
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().
Comment 2 Gustavo Giráldez 2003-09-25 04:01:23 UTC
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.
Comment 3 Gustavo Giráldez 2003-09-27 04:31:00 UTC
Changing status to NEEDINFO, so the actual state of the bug is more
obvious.  Sorry for the spam.
Comment 4 Gustavo Giráldez 2004-02-24 00:55:02 UTC
Changing subject to reflect current bug state.
Comment 5 André Klapper 2006-09-30 19:39:59 UTC
eric, gustavo, any news here? is this obsolete nowadays? if this is still an issue, which version is this about? thanks in advance.
Comment 6 Paolo Maggi 2006-09-30 19:48:17 UTC
Yes, this is still an open problem.
Comment 7 Paolo Borelli 2011-09-18 09:53:32 UTC
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 :)