diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-11 21:12:03 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-11 21:12:03 +0900 |
commit | 331b704d24158a25513a25540d2a5e82672606ec (patch) | |
tree | a3f6cb8f04132e0e04bf867508dca85cdd5b97d0 | |
parent | 141889082456efc9f10561dc0625dc2db6821bfc (diff) | |
parent | 6ea1a70e1be1cdb58c3a6ad3b7c3a30b9c3afb54 (diff) |
Merge pull request #50 from ueokande/fix-console-tokenizer
fix buffer commands
-rw-r--r-- | src/shared/commands.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/shared/commands.js b/src/shared/commands.js index 61044ec..8edeb5c 100644 --- a/src/shared/commands.js +++ b/src/shared/commands.js @@ -42,14 +42,18 @@ const winopenCommand = (url) => { }; const bufferCommand = (keywords) => { + if (keywords.length === 0) { + return Promise.resolve([]); + } + let keywordsStr = keywords.join(' '); return browser.tabs.query({ active: true, currentWindow: true }).then((gotTabs) => { if (gotTabs.length > 0) { - if (isNaN(keywords)) { - return tabs.selectByKeyword(gotTabs[0], keywords); + if (isNaN(keywordsStr)) { + return tabs.selectByKeyword(gotTabs[0], keywordsStr); } - let index = parseInt(keywords, 10) - 1; + let index = parseInt(keywordsStr, 10) - 1; return tabs.selectAt(index); } }); |