aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/completion.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'background_scripts/completion.coffee')
-rw-r--r--background_scripts/completion.coffee28
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