diff options
| author | Stephen Blott | 2015-05-11 08:56:20 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-11 08:56:20 +0100 |
| commit | f3156e30e7f1a347a5a7cfa755ad196e2948d78d (patch) | |
| tree | 4027dd812befac81806a7c1da5c1dc0bed656bef | |
| parent | 3c598c535081f2f6e33213329dd39fbc165b450c (diff) | |
| parent | ee418ed5a03eaeaf591ebcdf748dd07534a9bc85 (diff) | |
| download | vimium-f3156e30e7f1a347a5a7cfa755ad196e2948d78d.tar.bz2 | |
Merge branch 'search-engine-completion-v2' into search-engine-completion-v5
| -rw-r--r-- | background_scripts/completion.coffee | 4 | ||||
| -rw-r--r-- | pages/vomnibar.coffee | 7 |
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" |
