aboutsummaryrefslogtreecommitdiffstats
path: root/background_page.html
diff options
context:
space:
mode:
authorPhil Crosby2012-06-02 20:08:35 -0700
committerPhil Crosby2012-06-03 16:52:32 -0700
commite7f75e2c6add8048beb1f4dd2703766f016497bd (patch)
tree3ac47a4a7084b5349c4aabbd4a49cfb3acef3036 /background_page.html
parentd5e64794577e64ef92412e2f0a5794120a85d77b (diff)
downloadvimium-e7f75e2c6add8048beb1f4dd2703766f016497bd.tar.bz2
A WIP rewrite of completion in the vomnibar.
The purpose of this refactor is to simplify the contract so it's easier to modify, and to make some substantial usability improvements. One of the key differences is that matching is no longer fuzzy. If you want to search more than one term, separate them by spaces. This matches the behavior in Firefox. While fuzzy matching is a nice experience for a limited set of known items (like files in the current project), it doesn't work well for a huge messy collection, like URLs in your history. The query "hello" will match random stuff from your google search results for instance, and it's hard to prune that noise using ranking intelligence.
Diffstat (limited to 'background_page.html')
-rw-r--r--background_page.html27
1 files changed, 7 insertions, 20 deletions
diff --git a/background_page.html b/background_page.html
index a1af1396..709a6633 100644
--- a/background_page.html
+++ b/background_page.html
@@ -53,26 +53,12 @@
var tabLoadedHandlers = {}; // tabId -> function()
var completionSources = {
- smart: new completion.SmartKeywordCompleter({
- "wiki ": [ "Wikipedia (en)", "http://en.wikipedia.org/wiki/%s" ],
- "luck ": [ "Google Lucky (en)", "http://www.google.com/search?q=%s&btnI=I%27m+Feeling+Lucky" ],
- "cc " : [ "dict.cc", "http://www.dict.cc/?s=%s" ],
- ";" : [ "goto", "%s" ],
- "?" : [ "search", function(query) { return utils.createSearchUrl(query); }],
- }),
- domain: new completion.DomainCompleter(),
- bookmarks: new completion.FuzzyBookmarkCompleter(),
- history: new completion.FuzzyHistoryCompleter(20000),
- tabs: new completion.FuzzyTabCompleter(),
- }
+ bookmarks: new BookmarkCompleter(),
+ history: new HistoryCompleter()
+ };
+
var completers = {
- omni: new completion.MultiCompleter([
- completionSources.domain,
- completionSources.smart,
- completionSources.bookmarks,
- completionSources.history,
- ], 1),
- tabs: new completion.MultiCompleter([ completionSources.tabs ], 0),
+ omni: new MultiCompleter([completionSources.bookmarks, completionSources.history])
};
chrome.extension.onConnect.addListener(function(port, name) {
@@ -305,7 +291,8 @@
}
function filterCompleter(args, port) {
- completers[args.name].filter(args.query, args.maxResults, function(results) {
+ var queryTerms = args.query == "" ? [] : args.query.split(" ");
+ completers[args.name].filter(queryTerms, function(results) {
port.postMessage({ id: args.id, results: results });
});
}