diff options
| author | Stephen Blott | 2015-05-09 16:47:28 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-09 16:47:28 +0100 |
| commit | 311b35e416053a0d5d03eaf7eb894375f6e0f20d (patch) | |
| tree | 87773181649f2a61c443117fc36723ea27bc6ea1 /background_scripts | |
| parent | d73775057d443a53668f6a93fe45cc4a4b412de7 (diff) | |
| download | vimium-311b35e416053a0d5d03eaf7eb894375f6e0f20d.tar.bz2 | |
Search completion; tweaks and tests.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion.coffee | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 850a257d..7966452d 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -375,33 +375,37 @@ class SearchEngineCompleter custom = searchUrl? and keyword? searchUrl ?= Settings.get "searchUrl" haveDescription = description? and 0 < description.length - description ||= "#{if custom then "custom " else ""}search" + description ||= "search#{if custom then " [#{keyword}]" else ""}" queryTerms = queryTerms[1..] if custom query = queryTerms.join " " + haveCompletionEngine = CompletionEngines.haveCompletionEngine searchUrl + # If this is a custom search engine and we have a completer, then exclude results from other completers. + filter = + if custom and haveCompletionEngine + (suggestion) -> suggestion.type == description + else + null + # For custom search engines, we add an auto-selected suggestion. if custom suggestions.push new Suggestion queryTerms: queryTerms type: description url: Utils.createSearchUrl queryTerms, searchUrl - title: if haveDescription then query else "#{keyword}: #{query}" + title: query relevancy: 1 highlightTerms: false - autoSelect: true + insertText: query + # NOTE (smblott) Disbaled pending consideration of how to handle text selection within the vomnibar + # itself. + # autoSelect: true # Always reset the selection to this suggestion on query change. The UX is weird otherwise. - forceAutoSelect: true + # forceAutoSelect: true # Suppress the "w" from "w query terms" in the vomnibar input. suppressLeadingKeyword: true - - haveCompletionEngine = CompletionEngines.haveCompletionEngine searchUrl - # If this is a custom search engine and we have a completer, then exclude results from other completers. - filter = - if custom and haveCompletionEngine - (suggestion) -> suggestion.type == description - else - null + completeSuggestions: filter? # Post suggestions and bail if there is no prospect of adding further suggestions. if queryTerms.length == 0 or not haveCompletionEngine |
