diff options
| -rw-r--r-- | content_scripts/mode_key_handler.coffee | 2 | ||||
| -rw-r--r-- | tests/dom_tests/dom_tests.coffee | 2 | 
2 files changed, 3 insertions, 1 deletions
| diff --git a/content_scripts/mode_key_handler.coffee b/content_scripts/mode_key_handler.coffee index 586f9193..d06bddb5 100644 --- a/content_scripts/mode_key_handler.coffee +++ b/content_scripts/mode_key_handler.coffee @@ -89,6 +89,8 @@ class KeyHandlerMode extends Mode    handleKeyChar: (keyChar) ->      bgLog "Handling key #{keyChar}, mode=#{@name}." +    # A count prefix applies only so long a keyChar is mapped in @keyState[0]; e.g. 7gj should be 1j. +    @countPrefix = 0 unless keyChar of @keyState[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] diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee index ba0ee9d2..0745e5b2 100644 --- a/tests/dom_tests/dom_tests.coffee +++ b/tests/dom_tests/dom_tests.coffee @@ -452,7 +452,7 @@ context "Normal mode",      sendKeyboardEvent "z"      sendKeyboardEvent "z"      sendKeyboardEvent "p" -    assert.equal 2, commandCount +    assert.equal 1, commandCount    should "get the correct count for mixed inputs (with leading mapped keys)", ->      sendKeyboardEvent "z" | 
