Show errors on invalid --mode argument for :hint
This commit is contained in:
parent
d362299e4e
commit
96f28c6f72
@ -93,6 +93,7 @@ Fixed
|
|||||||
be shown for more files such as `qute://help/userscripts.html`.
|
be shown for more files such as `qute://help/userscripts.html`.
|
||||||
- Crash when doing initial run on Wayland without XWayland
|
- Crash when doing initial run on Wayland without XWayland
|
||||||
- Crash when trying to load an empty session file.
|
- Crash when trying to load an empty session file.
|
||||||
|
- `:hint` with an invalid `--mode=` value now shows a proper error.
|
||||||
|
|
||||||
Removed
|
Removed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -32,7 +32,7 @@ import attr
|
|||||||
from PyQt5.QtCore import pyqtSlot, QObject, Qt, QUrl
|
from PyQt5.QtCore import pyqtSlot, QObject, Qt, QUrl
|
||||||
from PyQt5.QtWidgets import QLabel
|
from PyQt5.QtWidgets import QLabel
|
||||||
|
|
||||||
from qutebrowser.config import config
|
from qutebrowser.config import config, configexc
|
||||||
from qutebrowser.keyinput import modeman, modeparsers
|
from qutebrowser.keyinput import modeman, modeparsers
|
||||||
from qutebrowser.browser import webelem
|
from qutebrowser.browser import webelem
|
||||||
from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners
|
from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners
|
||||||
@ -726,6 +726,12 @@ class HintManager(QObject):
|
|||||||
|
|
||||||
if mode is None:
|
if mode is None:
|
||||||
mode = config.val.hints.mode
|
mode = config.val.hints.mode
|
||||||
|
else:
|
||||||
|
opt = config.instance.get_opt('hints.mode')
|
||||||
|
try:
|
||||||
|
opt.typ.to_py(mode)
|
||||||
|
except configexc.ValidationError as e:
|
||||||
|
raise cmdexc.CommandError("Invalid mode: {}".format(e))
|
||||||
|
|
||||||
self._check_args(target, *args)
|
self._check_args(target, *args)
|
||||||
self._context = HintContext()
|
self._context = HintContext()
|
||||||
|
@ -15,6 +15,10 @@ Feature: Using hints
|
|||||||
And I hint with args "links normal" and follow xyz
|
And I hint with args "links normal" and follow xyz
|
||||||
Then the error "No hint xyz!" should be shown
|
Then the error "No hint xyz!" should be shown
|
||||||
|
|
||||||
|
Scenario: Using :hint with invalid mode.
|
||||||
|
When I run :hint --mode=foobar
|
||||||
|
Then the error "Invalid mode: Invalid value 'foobar' - valid values: number, letter, word" should be shown
|
||||||
|
|
||||||
### Opening in current or new tab
|
### Opening in current or new tab
|
||||||
|
|
||||||
Scenario: Following a hint and force to open in current tab.
|
Scenario: Following a hint and force to open in current tab.
|
||||||
|
Loading…
Reference in New Issue
Block a user