From b6e36246b97b29ad80edc0a0f037ca9985b951d9 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Sun, 30 Aug 2009 15:33:08 +0000 Subject: [PATCH] 'everything' - give exact matches higher priority - i.e. type "xt" and select a specific xterm window afterwards xt will put this item first in the list - cleanup SVN revision: 42107 --- src/modules/everything/evry_history.c | 32 ++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/modules/everything/evry_history.c b/src/modules/everything/evry_history.c index 9442ba1ef..cb9541e6a 100644 --- a/src/modules/everything/evry_history.c +++ b/src/modules/everything/evry_history.c @@ -65,7 +65,7 @@ _hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata { History_Entry *he = data; History_Item *hi; - Eina_List *l, *ll; + Eina_List *l, *ll, **keys = fdata; EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi) { @@ -87,7 +87,7 @@ _hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata if (!he->items) { E_FREE(he); - *((Eina_List **)fdata) = eina_list_append(*((Eina_List **)fdata), key); + *keys = eina_list_append(*keys, key); } return 1; @@ -256,6 +256,7 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input) const char *id; Eina_List *l; int cnt = 1; + int matched; if (it->id) id = it->id; @@ -268,13 +269,28 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input) { EINA_LIST_FOREACH(he->items, l, hi) { - if ((hi->plugin == it->plugin->name) && - ((!input[0]) || (!input[0] && !hi->input) || - (!strncmp(input, hi->input, strlen(input))) || - (!strncmp(input, hi->input, strlen(hi->input))))) + if (hi->plugin == it->plugin->name) { - cnt++; - it->usage += hi->last_used; + if ((!input[0]) || (!input[0] && !hi->input)) + { + cnt++; + it->usage += hi->last_used; + } + else + { + matched = 0; + if (!strncmp(input, hi->input, strlen(input))) + { + matched = 1; + it->usage += hi->last_used; + } + if (!strncmp(input, hi->input, strlen(hi->input))) + { + matched = 1; + it->usage += hi->last_used; + } + if (matched) cnt++; + } } } if (it->usage)