[gtksourceview/wip/regex-search] Regex search: document known issue with word boundaries
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/regex-search] Regex search: document known issue with word boundaries
- Date: Sun, 21 Jul 2013 16:07:08 +0000 (UTC)
commit a0392dd6b6c5649bc28b52ea8e075591481b9bef
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Jul 21 18:06:36 2013 +0200
Regex search: document known issue with word boundaries
gtksourceview/gtksourcesearch.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearch.c b/gtksourceview/gtksourcesearch.c
index eb53f8d..15f057b 100644
--- a/gtksourceview/gtksourcesearch.c
+++ b/gtksourceview/gtksourcesearch.c
@@ -151,6 +151,20 @@
* several idle loop iterations. (2) Once the subject string is retrieved
* completely, we launch the regex matching in a thread. (3) Once the thread
* is finished, we highlight the matches in the buffer. And voilà.
+ *
+ * Known issue:
+ * To search at word boundaries, \b is added at the beginning and at the
+ * end of the pattern. But \b is not the same as
+ * gtk_text_iter_starts_word() and gtk_text_iter_ends_word(). \b for
+ * example doesn't take the underscore as a word boundary.
+ * Using gtk_text_iter_starts_word() and ends_word() for regex searches
+ * is not easily possible: if the GRegex return a match, but doesn't
+ * start and end a word, maybe a shorter match (for a greedy pattern)
+ * start and end a word, or a longer match (for an ungreedy pattern). To
+ * be able to use the gtk_text_iter_starts_word() and ends_word()
+ * functions for regex search, g_regex_match_all_full() must be used, to
+ * retrieve _all_ matches, and test the word boundaries until a match is
+ * found at word boundaries.
*/
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]