From: Daniel Carl Date: Tue, 30 Jul 2013 20:49:51 +0000 (+0200) Subject: Fixed wrong bookmark lookup. X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=dd0b5b8db1d36fe1b8060d2a928545b0727c48d3;p=vimb.git Fixed wrong bookmark lookup. If the completion for bookmarks was started with given tags, there where also items displayed that have no tags set. This patch fixes the regression so that only those bookmarks are shown thats tags match the request, all other bookmarks can only be seen when the completion is started without tags like ':open !'. --- diff --git a/src/bookmark.c b/src/bookmark.c index 337ad2f..cdcdd78 100644 --- a/src/bookmark.c +++ b/src/bookmark.c @@ -173,7 +173,7 @@ char *bookmark_queue_pop(void) uri = g_strdup(lines[0]); /* don't process last empty line */ - len -= 1; + len -= 1; /* skip the first list that should be removed */ for (i = 1; i < len; i++) { g_string_append_printf(new, "%s\n", lines[i]); @@ -195,15 +195,25 @@ static GList *load(const char *file) /** * Checks if the given bookmark have all given query strings as prefix. + * + * @bm: bookmark to test if it matches + * @query: char array with tags to search for + * @qlen: length of given query char array + * + * Return: true if the bookmark contained all tags */ static gboolean bookmark_contains_all_tags(Bookmark *bm, char **query, unsigned int qlen) { unsigned int i, n, tlen; - if (!qlen || !bm->tags || !(tlen = g_strv_length(bm->tags))) { + if (!qlen) { return true; } + /* don't use bookmarks without tags if tags are used to filter */ + if (!bm->tags || !(tlen = g_strv_length(bm->tags))) { + return false; + } /* iterate over all query parts */ for (i = 0; i < qlen; i++) {