aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/completion_engines.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-06-04 17:22:02 +0100
committerStephen Blott2015-06-04 17:22:02 +0100
commitb5f4f1ab1f237795ed522f338dde2aa87bb35f42 (patch)
tree77b8b0f65398d097a6ce919eb54276ec01ee0406 /background_scripts/completion_engines.coffee
parenta402606774b8fe3bb04203f873804d61944553d6 (diff)
downloadvimium-b5f4f1ab1f237795ed522f338dde2aa87bb35f42.tar.bz2
Fix issue with Google-Maps completion failing.
Diffstat (limited to 'background_scripts/completion_engines.coffee')
-rw-r--r--background_scripts/completion_engines.coffee10
1 files changed, 5 insertions, 5 deletions
diff --git a/background_scripts/completion_engines.coffee b/background_scripts/completion_engines.coffee
index 9a88d491..dcbf99c6 100644
--- a/background_scripts/completion_engines.coffee
+++ b/background_scripts/completion_engines.coffee
@@ -46,14 +46,14 @@ class Google extends GoogleXMLRegexpEngine
class GoogleWithPrefix
constructor: (prefix, args...) ->
@engine = new Google args...
- @prefix = "#{prefix.trim()} "
- @queryTerms = @prefix.split /\s+/
+ @prefix = "#{prefix} "
+ @queryTerms = prefix.split /\s+/
match: (args...) -> @engine.match args...
getUrl: (queryTerms) -> @engine.getUrl [ @queryTerms..., queryTerms... ]
parse: (xhr) ->
- @engine.parse(xhr)
- .filter (suggestion) => suggestion.startsWith @prefix
- .map (suggestion) => suggestion[@prefix.length..].ltrim()
+ for suggestion in @engine.parse xhr
+ continue unless suggestion.startsWith @prefix
+ suggestion[@prefix.length..].ltrim()
# For Google Maps, we add the prefix "map of" to the query, and send it to Google's general search engine,
# then strip "map of" from the resulting suggestions.