From fc98a6e0e495bedbeef97e141895e8a8744c85d1 Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Fri, 26 Jul 2013 20:40:10 +0200
Subject: [PATCH] Use titles of url history to filter completion list.

---
 doc/vimb.1.txt | 4 ++--
 src/history.c  | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/vimb.1.txt b/doc/vimb.1.txt
index e41cd30..f22404e 100644
--- a/doc/vimb.1.txt
+++ b/doc/vimb.1.txt
@@ -400,8 +400,8 @@ prefix.
 .TP
 .B history
 The history of URLs is shown for the `:open ` and `:tabopen ` commands. This
-completion looks up for every given word in the list of the url history. Only
-those completion are shown that match every given word.
+completion looks up for every given word in the history url and titles. Only
+those history items are shown, where the title or url contains all tags.
 
 Example:
 ":open foo bar<tab>" will complete only URLs that contain the words foo and
diff --git a/src/history.c b/src/history.c
index 6c5f7b3..a099381 100644
--- a/src/history.c
+++ b/src/history.c
@@ -348,7 +348,9 @@ static gboolean history_item_contains_all_tags(History *item, char **query,
 
     /* iterate over all query parts */
     for (i = 0; i < qlen; i++) {
-        if (!util_strcasestr(item->first, query[i])) {
+        if (!(util_strcasestr(item->first, query[i])
+            || (item->second && util_strcasestr(item->second, query[i])))
+        ) {
             return false;
         }
     }
-- 
2.20.1