From f89b58f04af3eae05de9e999c39b2fe047fe6f4a Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 28 Feb 2016 06:48:03 +0000 Subject: 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. --- content_scripts/mode_passkeys.coffee | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'content_scripts/mode_passkeys.coffee') 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 -- cgit v1.2.3