diff options
| author | Stephen Blott | 2015-05-11 08:57:50 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-11 08:57:50 +0100 |
| commit | cee14fd4be36649aa96bb400ca3c2ed1937b4b5b (patch) | |
| tree | 97858ec3d92175e451122a5184abc6ea1f03afda | |
| parent | f3156e30e7f1a347a5a7cfa755ad196e2948d78d (diff) | |
| download | vimium-cee14fd4be36649aa96bb400ca3c2ed1937b4b5b.tar.bz2 | |
Search completion; disable on redundant whitespace.
| -rw-r--r-- | pages/vomnibar.coffee | 9 |
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 |
