From 5e838d8a303837d69a1239d762ef6b76b413bc7d Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sat, 1 Jun 2013 14:11:23 +0200 Subject: [PATCH] Changed search completion to match only prefixes (#27). --- src/history.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/history.c b/src/history.c index 0eb341d..176c516 100644 --- a/src/history.c +++ b/src/history.c @@ -89,7 +89,7 @@ GList *history_get_by_tags(HistoryType type, const char *tags) for (GList *l = src; l; l = l->next) { res = g_list_prepend(res, g_strdup((char*)l->data)); } - } else { + } else if (HISTORY_URL == type) { parts = g_strsplit(tags, " ", 0); len = g_strv_length(parts); @@ -100,6 +100,13 @@ GList *history_get_by_tags(HistoryType type, const char *tags) } } g_strfreev(parts); + } else { + for (GList *l = src; l; l = l->next) { + char *value = (char*)l->data; + if (g_str_has_prefix(value, tags)) { + res = g_list_prepend(res, g_strdup(value)); + } + } } g_list_free_full(src, (GDestroyNotify)g_free); -- 2.20.1