From 6660988a5b9142f972e98f9e7d2f2a2e44288419 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 13 Jun 2014 14:52:54 +0200 Subject: [PATCH] Don't evaluate hint keychains twice --- qutebrowser/keyinput/modeparsers.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/qutebrowser/keyinput/modeparsers.py b/qutebrowser/keyinput/modeparsers.py index 0cada903a..7b788b1ea 100644 --- a/qutebrowser/keyinput/modeparsers.py +++ b/qutebrowser/keyinput/modeparsers.py @@ -143,11 +143,19 @@ class HintKeyParser(CommandKeyParser): keystring_updated: If a new keystring should be set. """ handled = self._handle_single_key(e) - if handled: + if handled and self._keystring: + # A key has been added to the keystring (Match.partial) self.keystring_updated.emit(self._keystring) self._last_press = LastPress.keystring return handled - return self._handle_special_key(e) + elif handled: + # We handled the key but the keystring is empty. This happens when + # match is Match.definitive, so a keychain has been completed. + self._last_press = LastPress.none + return handled + else: + # We couldn't find a keychain so we check if it's a special key. + return self._handle_special_key(e) def execute(self, cmdstr, keytype, count=None): """Handle a completed keychain.