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 767978 - SearchContext: Ensure occurrences_count is updated in an edge case
SearchContext: Ensure occurrences_count is updated in an edge case
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
unspecified
Other All
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2016-06-23 14:47 UTC by Matthew Leeds
Modified: 2016-06-24 12:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
SearchContext: Ensure occurrences_count is updated in an edge case (1.95 KB, patch)
2016-06-23 14:48 UTC, Matthew Leeds
none Details | Review
SearchContext: Add test case for insertion on word boundaries (2.15 KB, patch)
2016-06-23 14:48 UTC, Matthew Leeds
none Details | Review
SearchContext: Update implementation documentation (1.98 KB, patch)
2016-06-23 14:48 UTC, Matthew Leeds
none Details | Review

Description Matthew Leeds 2016-06-23 14:47:56 UTC
There may be a more elegant way to do this but it works. I verified that the
unit test I wrote fails without these commits
Comment 1 Matthew Leeds 2016-06-23 14:48:00 UTC
Created attachment 330262 [details] [review]
SearchContext: Ensure occurrences_count is updated in an edge case

When at_word_boundaries is set in the SearchSettings and an insertion
occurs on a word boundary, the affected occurrence needs to be
re-scanned. This commit changes remove_occurrences_in_range to
properly adjust the given boundaries to accomplish this.
Comment 2 Matthew Leeds 2016-06-23 14:48:04 UTC
Created attachment 330263 [details] [review]
SearchContext: Add test case for insertion on word boundaries
Comment 3 Matthew Leeds 2016-06-23 14:48:08 UTC
Created attachment 330264 [details] [review]
SearchContext: Update implementation documentation
Comment 4 Sébastien Wilmet 2016-06-24 12:06:54 UTC
Thanks, I've reviewed carefully the patches, and it's indeed correct.
I've squashed the third commit with the first one.

Pushed on master:
commit adb7625dc5dee12c261d7ea2fe8b80f9bdbe965b
commit 86991baebf0d69601580db351dfd2ba387a84a05

I will backport the commits on 3.20.