diff options
| author | Stephen Blott | 2015-05-11 08:55:49 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-05-11 08:55:49 +0100 | 
| commit | ee418ed5a03eaeaf591ebcdf748dd07534a9bc85 (patch) | |
| tree | 0205a7c2b31c06620ad932f538885f313548ed19 /pages/vomnibar.coffee | |
| parent | c628508ce66f9f32ae88f36ae57a6b44f900ef88 (diff) | |
| download | vimium-ee418ed5a03eaeaf591ebcdf748dd07534a9bc85.tar.bz2 | |
Search completion; disable on redundant whitespace.
Diffstat (limited to 'pages/vomnibar.coffee')
| -rw-r--r-- | pages/vomnibar.coffee | 7 | 
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"  | 
