aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/completion.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-05-18 08:23:16 +0100
committerStephen Blott2015-05-18 08:23:16 +0100
commit4ec5e46ece2cd12d5ebb8db6a8ebcb8690687a1f (patch)
treec0892b54f4a709b8ae7e36f5763a71e925be68f2 /background_scripts/completion.coffee
parentb7f94dbcaea5c2bb944dfeaf6f929629834af723 (diff)
downloadvimium-4ec5e46ece2cd12d5ebb8db6a8ebcb8690687a1f.tar.bz2
Search completion; retain previous suggestions (comments and tweaks).
Diffstat (limited to 'background_scripts/completion.coffee')
-rw-r--r--background_scripts/completion.coffee5
1 files changed, 5 insertions, 0 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 8768a39f..e6e8deaf 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -480,9 +480,14 @@ class SearchEngineCompleter
# And the URL suffix (which must contain the query part) matches the current query.
RankingUtils.matches queryTerms, suggestion.url[engine.searchUrlPrefix.length..])
+ # If a previous suggestion still matches the query, then we keep it (even if the completion engine may not
+ # return it for the current query). This allows the user to pick suggestions by typing fragments of their
+ # text, without regard to whether the completion engine can complete the actual text of the query.
previousSuggestions =
for url, suggestion of @previousSuggestions
continue unless RankingUtils.matches queryTerms, suggestion.title
+ # Reset the previous relevancy and HTML, they may not be correct wrt. the current query.
+ extend suggestion, relevancy: null, html: null
suggestion.relevancy = null
suggestion