diff --git a/NEWS b/NEWS index f2142bc5..ccf1a9a7 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ 2007-xx-xx: * version 0.6 * THIS VERSION ONLY WORKS WITH FIREFOX 3.0 + * :open,:bmarks,etc. filter on space seperated tokens now, so you can + search with :open linux windows <tab> all your bookmarks/history + which contain linux AND windows in the url or title * :ls, :history and :bmarks output is now hyperlinked * tags and keyword support for :bmark * added full zoom, and changed keybindings slightly for text zoom diff --git a/content/bookmarks.js b/content/bookmarks.js index 94a61278..acc2bc4f 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -283,7 +283,7 @@ function Bookmarks() //{{{ if (items.length == 0) { - if (filter.length > 0) + if (filter.length > 0 || tags.length > 0) vimperator.echoerr("E283: No bookmarks matching \"" + filter + "\""); else vimperator.echoerr("No bookmarks set"); diff --git a/content/completion.js b/content/completion.js index 23e66e5f..0c8b4f73 100644 --- a/content/completion.js +++ b/content/completion.js @@ -531,7 +531,11 @@ vimperator.completion = (function() // {{{ if (url.indexOf(filter) == -1) { - if (title.indexOf(filter) >= 0) + // no direct match of filter in the url, but still accept this item + // if _all_ tokens of filter match either the url or the title + if (filter.split(/\s+/).every(function(token) { + return (url.indexOf(token) > -1 || title.indexOf(token) > -1); + })) additional_completions.push(urls[i]); continue; @@ -571,23 +575,16 @@ vimperator.completion = (function() // {{{ if (typeof(filter) != "string" || !items) return false; - if (case_sensitive) - { - for (var i = 0; i < items.length; i++) - { - if (items[i].indexOf(filter) > -1) - return true; - } - } - else + var items_str = items.join(" "); + if (!case_sensitive) { filter = filter.toLowerCase(); - for (var i = 0; i < items.length; i++) - { - if (items[i].toLowerCase().indexOf(filter) > -1) - return true; - } + items_str = items_str.toLowerCase(); } + + if (filter.split(/\s+/).every(function(str) { return items_str.indexOf(str) > -1; })) + return true; + return false; },