diff options
| author | Stephen Blott | 2016-02-27 14:44:34 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-05 05:37:40 +0000 |
| commit | 3f63ceb19046157692eac9e9a13486af7e50a57e (patch) | |
| tree | 53825a90da1064da8eed3894bad8e75ea2cfa03c | |
| parent | 34b1fb0f4e2ce1696c17e703d0bc43463355d6ba (diff) | |
| download | vimium-3f63ceb19046157692eac9e9a13486af7e50a57e.tar.bz2 | |
Key bindings; partially functioning w/ backgound commands.
| -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 |
