From: Daniel Carl <danielcarl@gmx.de>
Date: Sat, 1 Jun 2013 12:11:23 +0000 (+0200)
Subject: Changed search completion to match only prefixes (#27).
X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=5e838d8a303837d69a1239d762ef6b76b413bc7d;p=vimb.git

Changed search completion to match only prefixes (#27).
---

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);