From d705e600e212d4301d071dc7b2deeb60ef02e616 Mon Sep 17 00:00:00 2001 From: rr- Date: Fri, 13 Apr 2018 10:57:17 +0200 Subject: [PATCH] Simplify `num` in hinting to `first_run` --- qutebrowser/browser/hints.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 01333eff5..5e6e4064f 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -155,8 +155,7 @@ class HintContext: to_follow: The link to follow when enter is pressed. args: Custom arguments for userscript/spawn rapid: Whether to do rapid hinting. - num: While in rapid hinting, count how many times the action - has been executed so far. + first_run: Whether the action is run for the 1st time in rapid hinting. add_history: Whether to add yanked or spawned link to the history. filterstr: Used to save the filter string for restoring in rapid mode. tab: The WebTab object we started hinting in. @@ -169,7 +168,7 @@ class HintContext: baseurl = attr.ib(None) to_follow = attr.ib(None) rapid = attr.ib(False) - num = attr.ib(0) + first_run = attr.ib(True) add_history = attr.ib(False) filterstr = attr.ib(None) args = attr.ib(attr.Factory(list)) @@ -248,7 +247,7 @@ class HintActions: new_content = urlstr # only second and consecutive yanks are to append to the clipboard - if context.rapid and context.num > 1: + if context.rapid and not context.first_run: try: old_content = utils.get_clipboard(selection=sel) except utils.ClipboardEmptyError: @@ -914,7 +913,6 @@ class HintManager(QObject): else: # Reset filtering self.filter_hints(None) - self._context.num += 1 # Undo keystring highlighting for string, label in self._context.labels.items(): label.update_text('', string) @@ -924,6 +922,8 @@ class HintManager(QObject): except HintingError as e: message.error(str(e)) + self._context.first_run = False + @cmdutils.register(instance='hintmanager', scope='tab', modes=[usertypes.KeyMode.hint]) def follow_hint(self, select=False, keystring=None):