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 745790 - Search at word boundaries doesn't work with words that start with underscore
Search at word boundaries doesn't work with words that start with underscore
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
3.19.x
Other Linux
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-07 13:33 UTC by Kevin Hagner
Modified: 2016-06-11 17:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkSourceView test search widget (27.76 KB, image/png)
2016-01-28 20:57 UTC, sébastien lafargue
Details

Description Kevin Hagner 2015-03-07 13:33:40 UTC
The comportment expected with the * command is to find every other occurrences of the current word under the cursor. But when this word start with the underscore character, like private methods in the Python coding style convention, the search is not working.
Comment 1 Alexandre Franke 2015-03-07 13:50:00 UTC
This is somewhat related to bug 742976 although it is probably a different issue, but fixing the word boundary issue might fix the underscore one as a side effect?
Comment 2 sébastien lafargue 2016-01-28 20:57:46 UTC
Created attachment 319971 [details]
GtkSourceView test search widget
Comment 3 sébastien lafargue 2016-01-28 21:00:44 UTC
It's a GtkSourceView or maybe Pango prob, you can test it in the GtkSourceView search widget ( gtksourceview/tests/test-search )

We do search with at_word_boundaries activated
Comment 4 Sébastien Wilmet 2016-01-29 05:53:29 UTC
More probably a bug in gtksourceiter.c.
Comment 5 Sébastien Wilmet 2016-01-31 11:38:26 UTC
Hum no, the SearchContext doesn't use gtksourceiter functions… So it's more probably a bug in Pango word breaking rules.
Comment 6 sébastien lafargue 2016-01-31 12:18:40 UTC
maybe gsv search behaviour should use gtksourceiter ? there's underscore things in
Comment 7 Sébastien Wilmet 2016-01-31 12:39:59 UTC
Yes the Pango word boundaries take into account only natural-language words, which doesn't include the underscore.

The gtksourceiter functions are normally very similar to the GtkTextIter ones, so using gtksourciter in the SearchContext should not be too hard to do.
Comment 8 Sébastien Wilmet 2016-01-31 17:17:16 UTC
In gtksourceiter.h, there are two sections: the semi-public functions and the internal functions used only for the unit tests. For the SearchContext I think the best would be to use the "extra-natural word" boundaries, that is, a natural-language word as defined by Pango, plus the underscore. So those internal functions that deal with extra-natural words should be made semi-public.
Comment 9 Raunaq 2016-05-13 17:09:56 UTC
Hi!i would like to work on this bug.. Any advice?
Comment 10 Sébastien Wilmet 2016-05-13 18:03:14 UTC
It's an open question. The answer might be long depending on your experience, and I don't know if you are comfortable with GLib/GTK+. If you have more specific questions, don't hesitate to ask.

This might be useful:
https://people.gnome.org/~swilmet/glib-gtk-dev-platform.pdf
Comment 11 Sébastien Wilmet 2016-06-11 17:00:09 UTC
Done:
commit 958eadb4d69ddea793fffe71050453eba024caee
commit 64e248ab54ed76c6be2f1805328b5b22f1c6141a