From de3b4adfd8fed7ad549aeb4f2f27993ad9aa2f3e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 26 Feb 2018 20:48:49 +0100 Subject: [PATCH] Don't force-follow hints when typing chars --- qutebrowser/browser/hints.py | 11 +++++++++-- qutebrowser/keyinput/modeparsers.py | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 0390d5d1f..1d0184c73 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -909,20 +909,27 @@ class HintManager(QObject): @cmdutils.register(instance='hintmanager', scope='tab', modes=[usertypes.KeyMode.hint]) - def follow_hint(self, keystring=None): + def follow_hint(self, select=False, keystring=None): """Follow a hint. Args: + select: Only select the given hint, don't necessarily follow it. keystring: The hint to follow, or None. """ if keystring is None: if self._context.to_follow is None: raise cmdexc.CommandError("No hint to follow") + elif select: + raise cmdexc.CommandError("Can't use --select without hint.") else: keystring = self._context.to_follow elif keystring not in self._context.labels: raise cmdexc.CommandError("No hint {}!".format(keystring)) - self._fire(keystring) + + if select: + self._handle_auto_follow(keystring) + else: + self._fire(keystring) @pyqtSlot(usertypes.KeyMode) def on_mode_left(self, mode): diff --git a/qutebrowser/keyinput/modeparsers.py b/qutebrowser/keyinput/modeparsers.py index 84eb5baf1..583a65707 100644 --- a/qutebrowser/keyinput/modeparsers.py +++ b/qutebrowser/keyinput/modeparsers.py @@ -256,7 +256,7 @@ class HintKeyParser(keyparser.CommandKeyParser): """ self._read_config() self.bindings.update({keyutils.KeySequence.parse(s): - 'follow-hint ' + s for s in strings}) + 'follow-hint -s ' + s for s in strings}) if not preserve_filter: self._filtertext = ''