diff options
| author | Stephen Blott | 2015-05-17 06:11:45 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-17 06:27:49 +0100 |
| commit | 69cd8c08375cdf5df8636748f6f479552d780b8f (patch) | |
| tree | fb6fdb1af39f77d27dbed9bbae8c8f0366175e83 /background_scripts | |
| parent | c09e70364118264804510ee4b06f3ff8d38933b1 (diff) | |
| download | vimium-69cd8c08375cdf5df8636748f6f479552d780b8f.tar.bz2 | |
TabToOpen: tab to open vomnibar.
`o` then `Tab` opens the vomnibar completionlist with history
completions (the only completions) ranked by recently only. Hence, the
most recent requests are at the top.
This is a (far) simpler approach than #1662 which catches the most
important use case (repeat a search with an edited query).
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion.coffee | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index eb80f3cd..80b47055 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -225,7 +225,7 @@ class BookmarkCompleter RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.url, suggestion.title) class HistoryCompleter - filter: ({ queryTerms }, onComplete) -> + filter: ({ queryTerms, tabToOpen }, onComplete) -> @currentSearch = { queryTerms: @queryTerms, onComplete: @onComplete } results = [] HistoryCache.use (history) => @@ -233,6 +233,9 @@ class HistoryCompleter results = if queryTerms.length > 0 history.filter (entry) -> RankingUtils.matches(queryTerms, entry.url, entry.title) + else if tabToOpen + # <Tab> opens the completion list, even without a query. + history else [] onComplete results.map (entry) => @@ -256,6 +259,8 @@ class HistoryCompleter computeRelevancy: (suggestion) -> historyEntry = suggestion.relevancyData recencyScore = RankingUtils.recencyScore(historyEntry.lastVisitTime) + # If there are no query terms, then relevancy is based on recency alone. + return recencyScore if suggestion.queryTerms.length == 0 wordRelevancy = RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.url, suggestion.title) if suggestion.insertText? # If this suggestion matches a previous search with the default search engine, then we also score the |
