aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pages/vomnibar.coffee7
1 files changed, 6 insertions, 1 deletions
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee
index 196ad766..855218ea 100644
--- a/pages/vomnibar.coffee
+++ b/pages/vomnibar.coffee
@@ -135,8 +135,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"