diff options
| author | Stephen Blott | 2016-02-21 07:32:20 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-02-21 07:32:20 +0000 |
| commit | 1de41f55c121192556a7bf182211fb3b6deeccc8 (patch) | |
| tree | 06ebf1fe4590e1bbb8cd09330b3582d16c9ee859 | |
| parent | 972bf7a5e47f6f4abd9db5024914a87f0dad9084 (diff) | |
| download | vimium-1de41f55c121192556a7bf182211fb3b6deeccc8.tar.bz2 | |
Include count command option in repeat limit.
We need to multiply by `count=N` *before* checking `repeatLimit`.
Tweaks #2001.
| -rw-r--r-- | background_scripts/commands.coffee | 5 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index b4c503c1..74c2d08b 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -84,8 +84,9 @@ Commands = options[parse[0]] = if parse.length == 1 then true else parse[1] # We parse any `count` option immediately (to avoid having to parse it repeatedly later). - if "count" of options and not @availableCommands[command].noRepeat - options.count = if /^[1-9]/.test options.count then parseInt options.count else 1 + if "count" of options + options.count = parseInt options.count + delete options.count if isNaN(options.count) or @availableCommands[command].noRepeat options diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 196cf11f..a4162fc7 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -470,6 +470,7 @@ checkKeyQueue = (keysToCheck, tabId, frameId) -> if (Commands.keyToCommandRegistry[command]) registryEntry = Commands.keyToCommandRegistry[command] runCommand = true + count *= registryEntry.options.count ? 1 if registryEntry.noRepeat count = 1 @@ -482,8 +483,6 @@ checkKeyQueue = (keysToCheck, tabId, frameId) -> """ if runCommand - # Account for any command-option "count". - count *= registryEntry.options.count ? 1 if not registryEntry.isBackgroundCommand chrome.tabs.sendMessage tabId, name: "executePageCommand" |
