aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pages/vomnibar.coffee9
1 files changed, 7 insertions, 2 deletions
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee
index a2e5c56a..6268afdd 100644
--- a/pages/vomnibar.coffee
+++ b/pages/vomnibar.coffee
@@ -214,8 +214,13 @@ class VomnibarUI
return unless completion
- # Fetch the query and suggestion.
- query = @input.value.ltrim().split(/\s+/).join(" ").toLowerCase()
+ # 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 = value.ltrim().split(/\s+/).join(" ").toLowerCase()
suggestion = completion.title
index = suggestion.toLowerCase().indexOf query