diff options
| author | Stephen Blott | 2016-03-06 11:09:13 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-06 11:09:13 +0000 |
| commit | 88224d8ee99eac49a57f7137b5f056e151c6a426 (patch) | |
| tree | b15d1696a15e6342084afab26f99cfdd6d3b702d | |
| parent | 811d6e864de485a11bb46d4a0618b9a27027f3c7 (diff) | |
| download | vimium-88224d8ee99eac49a57f7137b5f056e151c6a426.tar.bz2 | |
Revert "Count prefix applies only to leading mapping."
This reverts commit 7774beb6643c0d905f9caba4345453790af948ad.
Reverting this. It can be done better (and capture some other incorrect
cases).
| -rw-r--r-- | content_scripts/mode_key_handler.coffee | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/content_scripts/mode_key_handler.coffee b/content_scripts/mode_key_handler.coffee index f2c4a745..586f9193 100644 --- a/content_scripts/mode_key_handler.coffee +++ b/content_scripts/mode_key_handler.coffee @@ -89,18 +89,14 @@ class KeyHandlerMode extends Mode handleKeyChar: (keyChar) -> bgLog "Handling key #{keyChar}, mode=#{@name}." - nextKeyState = (mapping[keyChar] for mapping in @keyState when keyChar of mapping) - command = (mapping for mapping in nextKeyState when "command" of mapping)[0] + # Advance the key state. The new key state is the current mappings of keyChar, plus @keyMapping. + @keyState = [(mapping[keyChar] for mapping in @keyState when keyChar of mapping)..., @keyMapping] + command = (mapping for mapping in @keyState when "command" of mapping)[0] if command - # Any count prefix applies only to the leading @keyState mapping; e.g., `7gj` should be `1j`. - @countPrefix = 0 unless command == @keyState[0][keyChar] count = if 0 < @countPrefix then @countPrefix else 1 bgLog "Calling mode=#{@name}, command=#{command.command}, count=#{count}." @reset() @commandHandler {command, count} - else - # Advance the key state. - @keyState = [nextKeyState..., @keyMapping] false # Suppress event. root = exports ? window |
