diff options
| author | Stephen Blott | 2016-03-06 11:13:51 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-06 11:13:51 +0000 |
| commit | 18d8c9043f8651a94885831c799e3fda7a8b1dc0 (patch) | |
| tree | e5179ae9e6dd1fe190aff5a04a8cc7c9016a36ed | |
| parent | 88224d8ee99eac49a57f7137b5f056e151c6a426 (diff) | |
| download | vimium-18d8c9043f8651a94885831c799e3fda7a8b1dc0.tar.bz2 | |
Fix count handling (again).
`7gj` should be `1j`.
Also, with:
map ab SOMETHING
`7aab` should be `1ab`.
Replacement for 7774beb6643c0d905f9caba4345453790af948ad.
| -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" |
