diff options
| author | Stephen Blott | 2012-11-05 15:17:25 +0000 |
|---|---|---|
| committer | Stephen Blott | 2012-11-05 15:17:25 +0000 |
| commit | 8b02be8162033c77a68e75f4d9cff612f30d4edd (patch) | |
| tree | 5100e12139ba161149b69f2c05374522ce127a98 /background_scripts | |
| parent | 450f0ec3e105a3c0eeeeac1fc2c9d58c2fc88597 (diff) | |
| download | vimium-8b02be8162033c77a68e75f4d9cff612f30d4edd.tar.bz2 | |
Avoid empty query terms.
With the previous version, a query like "hello there" yielded:
[ "hello", "", "", "there" ]
as the queryTerms.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/main.coffee | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 6ff3fa60..4c1b11ce 100644 --- a/background_scripts/main.coffee +++ b/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) |
