Added completion for search-queries.
authorDaniel Carl <danielcarl@gmx.de>
Sun, 21 Apr 2013 18:38:58 +0000 (20:38 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sun, 21 Apr 2013 18:38:58 +0000 (20:38 +0200)
README.md
doc/vimb.1.txt
src/completion.c

index b51dbbf..1c6a2ea 100644 (file)
--- a/README.md
+++ b/README.md
@@ -21,6 +21,7 @@ browsing-experience with low memory and cpu usage.
   - commands
   - urls
   - variable names of settings
+  - search-queries
 - hinting - marks links, form fields and other clickable elements to be
   clicked, opened or inspected
 - webinspector that opens ad the bottom of the browser window like in some
index b7d5d3b..18b1111 100644 (file)
@@ -211,6 +211,8 @@ file, or to find bookmarks from bookmark file. The urls from history will only
 be matched by their url, the bookmarks only by their tags. If multiple tags
 are given to get the bookmarks, only those bookmarks will be returned, that
 matches all the given tags or that don't have any tag set.
+.IP \n+[step]
+Searchqueries `/' or `?'
 .RE
 .TP
 .B complete-back
index 8b70451..128ea9c 100644 (file)
@@ -118,7 +118,7 @@ gboolean completion_complete(gboolean back)
         );
 
         history_list_free(&source);
-    } else {
+    } else if (*input == ':') {
         char *command = NULL;
         /* remove counts before command and save it to print it later in inputbox */
         comps.count = g_ascii_strtoll(&input[1], &command, 10);
@@ -130,6 +130,14 @@ gboolean completion_complete(gboolean back)
             ":"
         );
         g_list_free(source);
+    } else if (*input == '/' || *input == '?') {
+        source = g_list_sort(history_get_all(HISTORY_SEARCH), (GCompareFunc)g_strcmp0);
+        comps.completions = init_completion(
+            comps.completions,
+            filter_list(tmp, source, (Comp_Func)g_str_has_prefix, &input[1]),
+            *input == '/' ? "/" : "?"
+        );
+        g_list_free(source);
     }
 
     if (!comps.completions) {