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.
|
to_follow: The link to follow when enter is pressed.
|
||||||
args: Custom arguments for userscript/spawn
|
args: Custom arguments for userscript/spawn
|
||||||
rapid: Whether to do rapid hinting.
|
rapid: Whether to do rapid hinting.
|
||||||
num: While in rapid hinting, count how many times the action
|
first_run: Whether the action is run for the 1st time in rapid hinting.
|
||||||
has been executed so far.
|
|
||||||
add_history: Whether to add yanked or spawned link to the history.
|
add_history: Whether to add yanked or spawned link to the history.
|
||||||
filterstr: Used to save the filter string for restoring in rapid mode.
|
filterstr: Used to save the filter string for restoring in rapid mode.
|
||||||
tab: The WebTab object we started hinting in.
|
tab: The WebTab object we started hinting in.
|
||||||
@ -169,7 +168,7 @@ class HintContext:
|
|||||||
baseurl = attr.ib(None)
|
baseurl = attr.ib(None)
|
||||||
to_follow = attr.ib(None)
|
to_follow = attr.ib(None)
|
||||||
rapid = attr.ib(False)
|
rapid = attr.ib(False)
|
||||||
num = attr.ib(0)
|
first_run = attr.ib(True)
|
||||||
add_history = attr.ib(False)
|
add_history = attr.ib(False)
|
||||||
filterstr = attr.ib(None)
|
filterstr = attr.ib(None)
|
||||||
args = attr.ib(attr.Factory(list))
|
args = attr.ib(attr.Factory(list))
|
||||||
@ -248,7 +247,7 @@ class HintActions:
|
|||||||
new_content = urlstr
|
new_content = urlstr
|
||||||
|
|
||||||
# only second and consecutive yanks are to append to the clipboard
|
# 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:
|
try:
|
||||||
old_content = utils.get_clipboard(selection=sel)
|
old_content = utils.get_clipboard(selection=sel)
|
||||||
except utils.ClipboardEmptyError:
|
except utils.ClipboardEmptyError:
|
||||||
@ -914,7 +913,6 @@ class HintManager(QObject):
|
|||||||
else:
|
else:
|
||||||
# Reset filtering
|
# Reset filtering
|
||||||
self.filter_hints(None)
|
self.filter_hints(None)
|
||||||
self._context.num += 1
|
|
||||||
# Undo keystring highlighting
|
# Undo keystring highlighting
|
||||||
for string, label in self._context.labels.items():
|
for string, label in self._context.labels.items():
|
||||||
label.update_text('', string)
|
label.update_text('', string)
|
||||||
@ -924,6 +922,8 @@ class HintManager(QObject):
|
|||||||
except HintingError as e:
|
except HintingError as e:
|
||||||
message.error(str(e))
|
message.error(str(e))
|
||||||
|
|
||||||
|
self._context.first_run = False
|
||||||
|
|
||||||
@cmdutils.register(instance='hintmanager', scope='tab',
|
@cmdutils.register(instance='hintmanager', scope='tab',
|
||||||
modes=[usertypes.KeyMode.hint])
|
modes=[usertypes.KeyMode.hint])
|
||||||
def follow_hint(self, select=False, keystring=None):
|
def follow_hint(self, select=False, keystring=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user