aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2016-02-29 06:31:43 +0000
committerStephen Blott2016-03-05 05:40:11 +0000
commite4193e2752ee7132ff16a7ba977857f70df2946b (patch)
treec6ac4221e85cb2ffcb6daa58bd0932da755a0b34 /content_scripts
parent9cfa00bc7db3e07c3abbeb09e483d9fdf20bbc17 (diff)
downloadvimium-e4193e2752ee7132ff16a7ba977857f70df2946b.tar.bz2
Key bindings; tweaks.
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/mode_key_handler.coffee10
-rw-r--r--content_scripts/vimium_frontend.coffee2
2 files changed, 6 insertions, 6 deletions
diff --git a/content_scripts/mode_key_handler.coffee b/content_scripts/mode_key_handler.coffee
index 60633895..8c4ded43 100644
--- a/content_scripts/mode_key_handler.coffee
+++ b/content_scripts/mode_key_handler.coffee
@@ -63,12 +63,12 @@ class KeyHandlerMode extends Mode
handleKeyChar: (event, keyChar) ->
bgLog "Handling key #{keyChar}, mode=#{@name}."
@advanceKeyState keyChar
- commands = @keyState.filter (entry) -> entry.command
- if 0 < commands.length
- countPrefix = if 0 < @countPrefix then @countPrefix else 1
+ command = (@keyState.filter (entry) -> entry.command)[0]
+ if command?
+ count = if 0 < @countPrefix then @countPrefix else 1
@reset()
- bgLog "Calling mode=#{@name}, command=#{commands[0].command}, count=#{countPrefix}."
- @commandHandler command: commands[0], count: countPrefix, event: event
+ bgLog "Calling mode=#{@name}, command=#{command.command}, count=#{count}."
+ @commandHandler {command, count}
false # Suppress event.
# This returns the first key-state entry for which keyChar is mapped. The return value is truthy if a match
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 46b21ed0..a4dd6986 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -108,7 +108,7 @@ class NormalMode extends KeyHandlerMode
if area == "local" and changes.normalModeKeyStateMapping?.newValue
@setKeyMapping changes.normalModeKeyStateMapping.newValue
- commandHandler: ({command: registryEntry, count, event}) ->
+ commandHandler: ({command: registryEntry, count}) ->
count *= registryEntry.options.count ? 1
count = 1 if registryEntry.noRepeat