Simplify num
in hinting to first_run
This commit is contained in:
parent
46e4aeb3e9
commit
d705e600e2
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user