diff options
author | Florian Bruhin <git@the-compiler.org> | 2018-03-13 14:10:22 +0100 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2018-03-13 14:40:54 +0100 |
commit | b88ac51d25da043ca431b2cc12a353f34bce06f7 (patch) | |
tree | 15e86d361d27380e974884f2a7445dc799df859b /qutebrowser/keyinput/basekeyparser.py | |
parent | a7b6d179d40b9eeb854df6773de9f4a637d2b5f4 (diff) | |
download | qutebrowser-b88ac51d25da043ca431b2cc12a353f34bce06f7.tar.gz qutebrowser-b88ac51d25da043ca431b2cc12a353f34bce06f7.zip |
Fall back to non-keypad keys without any keypad bindings
Fixes #3701
Diffstat (limited to 'qutebrowser/keyinput/basekeyparser.py')
-rw-r--r-- | qutebrowser/keyinput/basekeyparser.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/qutebrowser/keyinput/basekeyparser.py b/qutebrowser/keyinput/basekeyparser.py index 1582a5485..014b16f80 100644 --- a/qutebrowser/keyinput/basekeyparser.py +++ b/qutebrowser/keyinput/basekeyparser.py @@ -147,10 +147,18 @@ class BaseKeyParser(QObject): return QKeySequence.NoMatch # First, try a straightforward match + self._debug_log("Trying simple match") match, binding = self._match_key(sequence) + # Then try without optional modifiers + if match == QKeySequence.NoMatch: + self._debug_log("Trying match without modifiers") + sequence = sequence.strip_modifiers() + match, binding = self._match_key(sequence) + # If that doesn't match, try a key_mapping if match == QKeySequence.NoMatch: + self._debug_log("Trying match with key_mappings") mapped = sequence.with_mappings(config.val.bindings.key_mappings) if sequence != mapped: self._debug_log("Mapped {} -> {}".format( @@ -159,10 +167,12 @@ class BaseKeyParser(QObject): sequence = mapped # If that doesn't match either, try treating it as count. + txt = str(sequence[-1]) # To account for sequences changed above. if (match == QKeySequence.NoMatch and txt.isdigit() and self._supports_count and not (not self._count and txt == '0')): + self._debug_log("Trying match as count") assert len(txt) == 1, txt if not dry_run: self._count += txt |