diff options
| -rw-r--r-- | background_scripts/main.coffee | 9 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 7 |
2 files changed, 14 insertions, 2 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 1838eb95..41b9bf8a 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -519,6 +519,14 @@ checkKeyQueue = (keysToCheck, tabId, frameId) -> newKeyQueue +runBackgroundCommand = ({frameId, registryEntry, count}) -> + if registryEntry.passCountToFunction + BackgroundCommands[registryEntry.command] count, frameId + else if registryEntry.noRepeat + BackgroundCommands[registryEntry.command] frameId + else + repeatFunction BackgroundCommands[registryEntry.command], count, 0, frameId + # # Message all tabs. Args should be the arguments hash used by the Chrome sendRequest API. # @@ -578,6 +586,7 @@ portHandlers = completions: handleCompletions sendRequestHandlers = + runBackgroundCommand: runBackgroundCommand getCompletionKeys: getCompletionKeysRequest getCurrentTabUrl: getCurrentTabUrl openUrlInNewTab: TabOperations.openUrlInNewTab diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index b46175fb..26942a30 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -117,11 +117,14 @@ window.initializeModes = -> @setKeyMapping changes.normalModeKeyStateMapping.newValue commandHandler: (registryEntry, count) -> + count *= registryEntry.options.count ? 1 + count = 1 if registryEntry.noRepeat + # TODO: Repeat limit. # TODO: Special handling of Vomnibar. + # TODO: Fix passKeys. if registryEntry.isBackgroundCommand - true # Not yet implemnted. + chrome.runtime.sendMessage { handler: "runBackgroundCommand", frameId, registryEntry, count} else - count = 1 if registryEntry.noRepeat if registryEntry.passCountToFunction Utils.invokeCommandString registryEntry.command, [count] else |
