diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-08-08 20:31:15 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 20:31:15 +0900 |
commit | ab857658c73ad732f240ff2bfc71dc97b0b4f76d (patch) | |
tree | b6300056510b41d50ebe75831f8791b5ec70043d | |
parent | b48c2f7804cbb43ac6cd797697292ae54313f89d (diff) | |
parent | c1d927bd38b04a961cd058af4dd65d9dd9df2f88 (diff) |
Merge pull request #450 from ueokande/fix-trim-start
Fix trim start
-rw-r--r-- | .circleci/config.yml | 2 | ||||
-rw-r--r-- | manifest.json | 2 | ||||
-rw-r--r-- | src/background/controllers/command.js | 13 |
3 files changed, 11 insertions, 6 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 11c1f95..495fc42 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ jobs: docker: - image: circleci/node:10-stretch-browsers environment: - - FIREFOX_VERSION: "60.0.2" + - FIREFOX_VERSION: "60.0esr" working_directory: ~ steps: - restore_cache: diff --git a/manifest.json b/manifest.json index 5e7551d..689ae5f 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Vim Vixen", "description": "Vim Vixen", - "version": "0.16", + "version": "0.17", "icons": { "48": "resources/icon_48x48.png", "96": "resources/icon_96x96.png" diff --git a/src/background/controllers/command.js b/src/background/controllers/command.js index befab42..9ab1054 100644 --- a/src/background/controllers/command.js +++ b/src/background/controllers/command.js @@ -2,6 +2,11 @@ import CompletionsInteractor from '../usecases/completions'; import CommandInteractor from '../usecases/command'; import Completions from '../domains/completions'; +const trimStart = (str) => { + // NOTE String.trimStart is available on Firefox 61 + return str.replace(/^\s+/, ''); +}; + export default class CommandController { constructor() { this.completionsInteractor = new CompletionsInteractor(); @@ -9,13 +14,13 @@ export default class CommandController { } getCompletions(line) { - let trimmed = line.trimStart(); + let trimmed = trimStart(line); let words = trimmed.split(/ +/); let name = words[0]; if (words.length === 1) { return this.completionsInteractor.queryConsoleCommand(name); } - let keywords = trimmed.slice(name.length).trimStart(); + let keywords = trimStart(trimmed.slice(name.length)); switch (words[0]) { case 'o': case 'open': @@ -45,14 +50,14 @@ export default class CommandController { // eslint-disable-next-line complexity exec(line) { - let trimmed = line.trimStart(); + let trimmed = trimStart(line); let words = trimmed.split(/ +/); let name = words[0]; if (words[0].length === 0) { return Promise.resolve(); } - let keywords = trimmed.slice(name.length).trimStart(); + let keywords = trimStart(trimmed.slice(name.length)); switch (words[0]) { case 'o': case 'open': |