[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 72/473: Tweak search algorithm.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:54:02 CET 2015


This is an automated email from the git hooks/post-receive script.

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 03ec77407cbd6f3ec1f554ace8825fb31d0dba6c
Author: Graeme Gott <graeme at gottcode.org>
Date:   Sat Jul 6 06:51:27 2013 -0400

    Tweak search algorithm.
---
 src/query.cpp |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/query.cpp b/src/query.cpp
index c9f625e..b92888a 100644
--- a/src/query.cpp
+++ b/src/query.cpp
@@ -118,14 +118,19 @@ unsigned int Query::match(const std::string& haystack) const
 	// Check if haystack contains query as characters
 	bool characters_start_words = true;
 	bool start_word = true;
+	bool started = false;
 	const gchar* query_string = m_query.c_str();
 	for (const gchar* pos = haystack.c_str(); *pos; pos = g_utf8_next_char(pos))
 	{
 		gunichar c = g_utf8_get_char(pos);
 		if (c == g_utf8_get_char(query_string))
 		{
-			characters_start_words &= start_word;
-			query_string = g_utf8_next_char(query_string);
+			if (start_word || started)
+			{
+				characters_start_words &= start_word;
+				query_string = g_utf8_next_char(query_string);
+				started = true;
+			}
 			start_word = false;
 		}
 		else if (g_unichar_isspace(c))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list