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 ff51320d83908dbed0aad9ccd9f47c4fefa2c7f2
Author: Graeme Gott <[email protected]>
Date:   Fri Feb 20 08:20:50 2015 -0500

    Sort character matches after substring matches.
---
 panel-plugin/launcher.cpp |    4 ++++
 panel-plugin/query.cpp    |   14 +++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/panel-plugin/launcher.cpp b/panel-plugin/launcher.cpp
index be92835..7ada6b3 100644
--- a/panel-plugin/launcher.cpp
+++ b/panel-plugin/launcher.cpp
@@ -277,6 +277,10 @@ int Launcher::search(const Query& query)
        int match = query.match(m_search_name);
        if (match != G_MAXINT)
        {
+               if (match > 5)
+               {
+                       match += 10;
+               }
                return match;
        }
 
diff --git a/panel-plugin/query.cpp b/panel-plugin/query.cpp
index 40cc9c6..3bcbfa0 100644
--- a/panel-plugin/query.cpp
+++ b/panel-plugin/query.cpp
@@ -113,6 +113,12 @@ int Query::match(const std::string& haystack) const
                }
        }
 
+       // Check if haystack contains query
+       if (pos != std::string::npos)
+       {
+               return 5;
+       }
+
        // Check if haystack contains query as characters
        bool characters_start_words = true;
        bool start_word = true;
@@ -143,13 +149,7 @@ int Query::match(const std::string& haystack) const
        int result = INT_MAX;
        if (*query_string == 0)
        {
-               result = characters_start_words ? 5 : 7;
-       }
-
-       // Check if haystack contains query
-       if ((result > 5) && (pos != std::string::npos))
-       {
-               result = 6;
+               result = characters_start_words ? 6 : 7;
        }
 
        return result;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
[email protected]
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to