From: Daniel Carl Date: Sun, 21 Apr 2013 18:38:58 +0000 (+0200) Subject: Added completion for search-queries. X-Git-Url: https://git.owens.tech/assets/static/git.owens.tech/assets/static/git.owens.tech/git?a=commitdiff_plain;h=1c9e893cf39723ddaeca8986f9fa77418d62fa5b;p=vimb.git Added completion for search-queries. --- diff --git a/README.md b/README.md index b51dbbf..1c6a2ea 100644 --- 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 diff --git a/doc/vimb.1.txt b/doc/vimb.1.txt index b7d5d3b..18b1111 100644 --- a/doc/vimb.1.txt +++ b/doc/vimb.1.txt @@ -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 diff --git a/src/completion.c b/src/completion.c index 8b70451..128ea9c 100644 --- a/src/completion.c +++ b/src/completion.c @@ -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) {