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 702977 - Problem with gtk_text_iter_forward_search(), multi-byte characters, case sensitive
Problem with gtk_text_iter_forward_search(), multi-byte characters, case sens...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
3.9.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 705407 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-06-24 13:37 UTC by Sébastien Wilmet
Modified: 2013-08-03 15:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
textiter: bug fix in forward_search() and backward_search() (3.75 KB, patch)
2013-06-24 17:34 UTC, Sébastien Wilmet
accepted-commit_now Details | Review

Description Sébastien Wilmet 2013-06-24 13:37:20 UTC
Probably with gtk_text_iter_backward_search() too.

If the buffer contains "éb" (é is a two-bytes character), and we search "éb", only "é" will be returned.

The bug doesn't occur with the GTK_TEXT_SEARCH_CASE_INSENSITIVE flag enabled.

I plan to write more unit tests and fix the bug in the near future.
Comment 1 Sébastien Wilmet 2013-06-24 17:34:04 UTC
Created attachment 247659 [details] [review]
textiter: bug fix in forward_search() and backward_search()

When the search is case sensitive, g_utf8_normalize() is not called, so
the skip_decomp argument of the function forward_chars_with_skipping()
must be FALSE.

To verify that, when searching "éb", the count parameter of
forward_chars_with_skipping() have a different value:
- case sensitive: count = 2
- case insensitive: count = 3 (g_utf8_normalize() has been called)

The commit adds unit tests that didn't pass before, and that now pass
(without known regression, obviously).
Comment 2 Ignacio Casal Quinteiro (nacho) 2013-06-24 17:59:10 UTC
Review of attachment 247659 [details] [review]:

Looks good to me.
Comment 3 Sébastien Wilmet 2013-06-24 18:15:44 UTC
Pushed, thank you for the review.
Comment 4 Sébastien Wilmet 2013-08-03 15:04:36 UTC
*** Bug 705407 has been marked as a duplicate of this bug. ***