[geany/geany] 148788: Don't find start of word when whole word matching should prevent it

Nick Treleaven git-noreply at xxxxx
Sat Mar 16 13:26:52 UTC 2013


Branch:      refs/heads/master
Author:      Nick Treleaven <nick.treleaven at btinternet.com>
Committer:   Nick Treleaven <nick.treleaven at btinternet.com>
Date:        Sat, 16 Mar 2013 13:26:52 UTC
Commit:      14878850cdf93b59044afb32a3d7537dd898a8bb
             https://github.com/geany/geany/commit/14878850cdf93b59044afb32a3d7537dd898a8bb

Log Message:
-----------
Don't find start of word when whole word matching should prevent it


Modified Paths:
--------------
    src/search.c

Modified: src/search.c
13 files changed, 8 insertions(+), 5 deletions(-)
===================================================================
@@ -1186,11 +1186,14 @@ gint search_mark_all(GeanyDocument *doc, const gchar *search_text, gint flags)
 }
 
 
-#define int_search_flags(match_case, whole_word, regexp, word_start) \
-	((match_case ? SCFIND_MATCHCASE : 0) | \
-	(whole_word ? SCFIND_WHOLEWORD : 0) | \
-	(regexp ? SCFIND_REGEXP | SCFIND_POSIX : 0) | \
-	(word_start ? SCFIND_WORDSTART : 0))
+static gboolean int_search_flags(gint match_case, gint whole_word, gint regexp, gint word_start)
+{
+	return (match_case ? SCFIND_MATCHCASE : 0) |
+		(regexp ? SCFIND_REGEXP | SCFIND_POSIX : 0) |
+		(whole_word ? SCFIND_WHOLEWORD : 0) |
+		/* SCFIND_WORDSTART overrides SCFIND_WHOLEWORD, but we want the opposite */
+		(word_start && !whole_word ? SCFIND_WORDSTART : 0);
+}
 
 
 static void



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list