diff options
| author | Stephen Blott | 2016-02-28 06:48:03 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-05 05:38:30 +0000 |
| commit | f89b58f04af3eae05de9e999c39b2fe047fe6f4a (patch) | |
| tree | 6a544ed83a8452507b1a929a48026d14294c6c84 /content_scripts/mode_passkeys.coffee | |
| parent | 18b8db13fa5184e0cc3ac5fd6645620fdb9d5cef (diff) | |
| download | vimium-f89b58f04af3eae05de9e999c39b2fe047fe6f4a.tar.bz2 | |
Key bindings; more tweaks and fixes.
Miscellaneous fixes and tweaks, including:
- Reinstate key logging.
- Fix count handling in line with expected behaviour in #2024.
- Remove `noCount` option; we don't need it.
- Simplify logic in various places.
Fixes #2024.
Diffstat (limited to 'content_scripts/mode_passkeys.coffee')
| -rw-r--r-- | content_scripts/mode_passkeys.coffee | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/content_scripts/mode_passkeys.coffee b/content_scripts/mode_passkeys.coffee index 426e5369..a68fe3be 100644 --- a/content_scripts/mode_passkeys.coffee +++ b/content_scripts/mode_passkeys.coffee @@ -3,20 +3,17 @@ class PassKeysMode extends Mode constructor: (@normalMode) -> super name: "passkeys" - trackState: true # Maintain @enabled, @passKeys and @keyQueue. + trackState: true # Maintain @passKeys. keydown: (event) => @handleKeyChar event, KeyboardUtils.getKeyChar event keypress: (event) => @handleKeyChar event, String.fromCharCode event.charCode keyup: (event) => @handleKeyChar event, KeyboardUtils.getKeyChar event - # Keystrokes are *never* considered passKeys if the user has begin entering a command. So, for example, if - # 't' is a passKey, then 'gt' and '99t' will neverthless be handled by Vimium. + # Keystrokes are *never* considered passKeys if the user has begun entering a command. So, for example, if + # 't' is a passKey, then 'gt' and '99t' are neverthless be handled by Vimium. handleKeyChar: (event, keyChar) -> return @continueBubbling if event.altKey or event.ctrlKey or event.metaKey - return @continueBubbling unless keyChar and keyChar.length == 1 - # Test whether the user has already begun entering a command. - return @continueBubbling unless @normalMode.isFirstKeyChar keyChar - return @continueBubbling unless 0 <= @passKeys.indexOf keyChar - # This is a passkey. + return @continueBubbling unless keyChar and @normalMode.isFirstKeyChar keyChar + return @continueBubbling unless keyChar.length == 1 and 0 <= @passKeys.indexOf keyChar @stopBubblingAndTrue root = exports ? window |
