diff options
| author | Stephen Blott | 2015-02-06 06:37:12 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-02-06 06:37:12 +0000 |
| commit | 63d4a74c54b6a70e8399aebc51c759f80b9866af (patch) | |
| tree | 77d87e8c8f11ea7cdbb405e15e987d382dee130d /background_scripts | |
| parent | d22a66f91a12aef832a87f39a1376b2f97fcfe94 (diff) | |
| download | vimium-63d4a74c54b6a70e8399aebc51c759f80b9866af.tar.bz2 | |
Fix search-engine auto selection.
In #1389/c52c0ea57f86c1c5a132819fe85e763db84ce712 we added descriptions
to search engines. We (I) omitted to realise that the "type" of a
selection (in particular, the constant "search") is also used to
determine whether the suggestion is automatically selected by the
vomnibar.
This fixes that, such that custom search engines with descriptions are
now automatically selected in the vomnibar.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion.coffee | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index d6402019..177892fb 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -21,6 +21,8 @@ class Suggestion # - extraRelevancyData: data (like the History item itself) which may be used by the relevancy function. constructor: (@queryTerms, @type, @url, @title, @computeRelevancyFunction, @extraRelevancyData) -> @title ||= "" + # When @autoSelect is truthy, the suggestion is automatically pre-selected in the vomnibar. + @autoSelect = false computeRelevancy: -> @relevancy = @computeRelevancyFunction(this) @@ -335,6 +337,7 @@ class SearchEngineCompleter type = "search" query = queryTerms[0] + ": " + queryTerms[1..].join(" ") suggestion = new Suggestion(queryTerms, type, url, query, @computeRelevancy) + suggestion.autoSelect = true suggestions.push(suggestion) onComplete(suggestions) |
