aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_scripts/completion.coffee4
-rw-r--r--pages/vomnibar.coffee7
2 files changed, 8 insertions, 3 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 018740c0..e6814831 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -231,8 +231,8 @@ class DomainCompleter
# If `referenceCount` goes to zero, the domain entry can and should be deleted.
domains: null
- filter: ({ queryTerms }, onComplete) ->
- return onComplete([]) unless queryTerms.length == 1
+ filter: ({ queryTerms, query }, onComplete) ->
+ return onComplete [] unless queryTerms.length == 1 and not /\s$/.test query
if @domains
@performSearch(queryTerms, onComplete)
else
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee
index 5cd2e2f1..a2e5c56a 100644
--- a/pages/vomnibar.coffee
+++ b/pages/vomnibar.coffee
@@ -134,8 +134,13 @@ class VomnibarUI
completions = @completions.filter (completion) ->
completion.selectCommonMatches? and completion.selectCommonMatches
+ # Bail on leading whitespace or on redundant whitespace. This provides users with a way to force this
+ # feature off.
+ value = @input.value
+ return if /^\s/.test(value) or /\s\s/.test value
+
# Fetch the query and the suggestion texts.
- query = @input.value.ltrim().split(/\s+/).join(" ").toLowerCase()
+ query = value.ltrim().split(/\s+/).join(" ").toLowerCase()
suggestions = completions.map (completion) -> completion.title
# Some completion engines add text at the start of the suggestion; for example, Bing takes "they might be"