summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-08-17 11:54:03 +0200
committerFlorian Bruhin <me@the-compiler.org>2021-08-17 12:12:02 +0200
commite8d9b1772f054c50d98a51cc91f7ef253c51edd3 (patch)
tree3aacfb2e074e3cfe138be7a53a5d9a600abc61bb
parent6b30806ebc0aa4823c08bf7af9067b041db51e88 (diff)
downloadqutebrowser-e8d9b1772f054c50d98a51cc91f7ef253c51edd3.tar.gz
qutebrowser-e8d9b1772f054c50d98a51cc91f7ef253c51edd3.zip
Further simplify rapid hint target check
-rw-r--r--doc/help/commands.asciidoc5
-rw-r--r--qutebrowser/browser/hints.py39
2 files changed, 13 insertions, 31 deletions
diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc
index 0f69841a8..49b17c3df 100644
--- a/doc/help/commands.asciidoc
+++ b/doc/help/commands.asciidoc
@@ -679,9 +679,8 @@ Start hinting.
* +*-a*+, +*--add-history*+: Whether to add the spawned or yanked link to the browsing history.
* +*-r*+, +*--rapid*+: Whether to do rapid hinting. With rapid hinting, the hint mode isn't left after a hint is followed, so you can easily
- open multiple links. Note this won't work with targets `tab`
- (unless `tabs.background` is set), `tab-fg`, `fill` and
- `right-click`.
+ open multiple links. Note this won't work with targets
+ `tab-fg`, `fill`, `delete` and `right-click`.
* +*-f*+, +*--first*+: Click the first hinted element without prompting.
diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py
index a2d628c69..f03eca7af 100644
--- a/qutebrowser/browser/hints.py
+++ b/qutebrowser/browser/hints.py
@@ -684,9 +684,8 @@ class HintManager(QObject):
Args:
rapid: Whether to do rapid hinting. With rapid hinting, the hint
mode isn't left after a hint is followed, so you can easily
- open multiple links. Note this won't work with targets `tab`
- (unless `tabs.background` is set), `tab-fg`, `fill` and
- `right-click`.
+ open multiple links. Note this won't work with targets
+ `tab-fg`, `fill`, `delete` and `right-click`.
add_history: Whether to add the spawned or yanked link to the
browsing history.
first: Click the first hinted element without prompting.
@@ -754,31 +753,15 @@ class HintManager(QObject):
if mode_manager.mode == usertypes.KeyMode.hint:
modeman.leave(self._win_id, usertypes.KeyMode.hint, 're-hinting')
- if rapid:
- if target in [
- Target.normal,
- Target.current,
- # Target.tab handled below
- # not Target.tab_fg
- Target.tab_bg,
- Target.window,
- Target.yank,
- Target.yank_primary,
- Target.run,
- # not Target.fill
- Target.hover,
- Target.download,
- Target.userscript,
- Target.spawn,
- # not Target.right_click
- ]:
- pass
- elif target == Target.tab and config.val.tabs.background:
- pass
- else:
- name = target.name.replace('_', '-')
- raise cmdutils.CommandError("Rapid hinting makes no sense "
- "with target {}!".format(name))
+ if rapid and target in [
+ Target.tab_fg, # opens new tab
+ Target.fill, # exits hint mode
+ Target.right_click, # opens multiple context menus
+ Target.delete, # deleting elements shifts them
+ ]:
+ name = target.name.replace('_', '-')
+ raise cmdutils.CommandError(
+ f"Rapid hinting makes no sense with target {name}!")
self._check_args(target, *args)