diff options
author | Florian Bruhin <git@the-compiler.org> | 2018-02-26 10:33:18 +0100 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2018-02-26 10:33:18 +0100 |
commit | 9aa37febbedf3232d050c83b724a98994882310e (patch) | |
tree | 8a60894933ee864c5246aae9bfff011323038348 /qutebrowser/keyinput/modeparsers.py | |
parent | be4cd94207e3da5743227e32af8b949e61f1b34d (diff) | |
download | qutebrowser-9aa37febbedf3232d050c83b724a98994882310e.tar.gz qutebrowser-9aa37febbedf3232d050c83b724a98994882310e.zip |
Make hints work
Diffstat (limited to 'qutebrowser/keyinput/modeparsers.py')
-rw-r--r-- | qutebrowser/keyinput/modeparsers.py | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/qutebrowser/keyinput/modeparsers.py b/qutebrowser/keyinput/modeparsers.py index 37fde6a14..d22b27d22 100644 --- a/qutebrowser/keyinput/modeparsers.py +++ b/qutebrowser/keyinput/modeparsers.py @@ -213,8 +213,9 @@ class HintKeyParser(keyparser.CommandKeyParser): True if the match has been handled, False otherwise. """ # FIXME rewrite this - match = super().handle(e) + match = self._handle_key(e) if match == QKeySequence.PartialMatch: + # FIXME do we need to check self._sequence here? self.keystring_updated.emit(str(self._sequence)) self._last_press = LastPress.keystring return True @@ -229,17 +230,20 @@ class HintKeyParser(keyparser.CommandKeyParser): else: raise ValueError("Got invalid match type {}!".format(match)) - def execute(self, cmdstr, keytype, count=None): - """Handle a completed keychain.""" - if not isinstance(keytype, self.Type): - raise TypeError("Type {} is no Type member!".format(keytype)) - if keytype == self.Type.chain: - hintmanager = objreg.get('hintmanager', scope='tab', - window=self._win_id, tab='current') - hintmanager.handle_partial_key(cmdstr) - else: - # execute as command - super().execute(cmdstr, keytype, count) + return match != QKeySequence.NoMatch + + # FIXME why is this needed? + # def execute(self, cmdstr, keytype, count=None): + # """Handle a completed keychain.""" + # if not isinstance(keytype, self.Type): + # raise TypeError("Type {} is no Type member!".format(keytype)) + # if keytype == self.Type.chain: + # hintmanager = objreg.get('hintmanager', scope='tab', + # window=self._win_id, tab='current') + # hintmanager.handle_partial_key(cmdstr) + # else: + # # execute as command + # super().execute(cmdstr, keytype, count) def update_bindings(self, strings, preserve_filter=False): """Update bindings when the hint strings changed. @@ -249,7 +253,9 @@ class HintKeyParser(keyparser.CommandKeyParser): preserve_filter: Whether to keep the current value of `self._filtertext`. """ - self.bindings = {keyutils.KeySequence(s): s for s in strings} + self._read_config() + self.bindings.update({keyutils.KeySequence(s): + 'follow-hint ' + s for s in strings}) if not preserve_filter: self._filtertext = '' |