Skip to content

Commit 3ed13fa

Browse files
Fix pass key handling.
Assume `x` is a passkey. `zH` and `zL` are mapped as usual. Then in the sequence `zx`, `x` should still be a pass key. This fixes that behaviour. Fixes philc#3271.
1 parent 729d7ef commit 3ed13fa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

content_scripts/mode_key_handler.coffee

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ class KeyHandlerMode extends Mode
7373
# Keystrokes are *never* considered pass keys if the user has begun entering a command. So, for example, if
7474
# 't' is a passKey, then the "t"-s of 'gt' and '99t' are neverthless handled as regular keys.
7575
isPassKey: (keyChar) ->
76-
@isInResetState() and keyChar in (@passKeys ? "")
76+
# Find all *continuation* mappings for keyChar in the current key state (i.e. not the full key mapping).
77+
mappings = (mapping for mapping in @keyState when keyChar of mapping and mapping != @keyMapping)
78+
# If there are no continuation mappings, and there's no count prefix, and keyChar is a pass key, then
79+
# it's a pass key.
80+
mappings.length == 0 and @countPrefix == 0 and keyChar in (@passKeys ? "")
7781

7882
isInResetState: ->
7983
@countPrefix == 0 and @keyState.length == 1

0 commit comments

Comments
 (0)