Permalink
Browse files

Avoid empty query terms.

With the previous version, a query like "hello   there" yielded:
  [ "hello", "", "", "there" ]
as the queryTerms.
  • Loading branch information...
1 parent 450f0ec commit 8b02be8162033c77a68e75f4d9cff612f30d4edd @smblott-github smblott-github committed Nov 5, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 background_scripts/main.coffee
@@ -192,8 +192,9 @@ handleSettings = (args, port) ->
refreshCompleter = (request) -> completers[request.name].refresh()
+whitespaceRegexp = /\s+/
filterCompleter = (args, port) ->
- queryTerms = if (args.query == "") then [] else args.query.split(" ")
+ queryTerms = if (args.query == "") then [] else args.query.split(whitespaceRegexp)
completers[args.name].filter(queryTerms, (results) -> port.postMessage({ id: args.id, results: results }))
getCurrentTimeInSeconds = -> Math.floor((new Date()).getTime() / 1000)

0 comments on commit 8b02be8

Please sign in to comment.