diff options
-rw-r--r-- | doc/changelog.asciidoc | 2 | ||||
-rw-r--r-- | doc/faq.asciidoc | 11 | ||||
-rw-r--r-- | qutebrowser/browser/hints.py | 8 | ||||
-rw-r--r-- | qutebrowser/keyinput/macros.py | 9 | ||||
-rw-r--r-- | tests/end2end/features/hints.feature | 4 |
5 files changed, 28 insertions, 6 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 28992a1ea..1e554452b 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -82,6 +82,7 @@ Changed - The `scrolling.bar` setting now takes three values instead of being a boolean: `always`, `never`, and `when-searching` (which only displays it while a search is active). +- '@@' now repeats the last run macro. Fixed ~~~~~ @@ -92,6 +93,7 @@ Fixed be shown for more files such as `qute://help/userscripts.html`. - Crash when doing initial run on Wayland without XWayland - Crash when trying to load an empty session file. +- `:hint` with an invalid `--mode=` value now shows a proper error. Removed ~~~~~~~ diff --git a/doc/faq.asciidoc b/doc/faq.asciidoc index 05314ec6f..5cb86f27e 100644 --- a/doc/faq.asciidoc +++ b/doc/faq.asciidoc @@ -147,13 +147,14 @@ It also works nicely with rapid hints: ---- How do I use qutebrowser with mutt?:: - Due to a Qt limitation, local files without `.html` extensions are - "downloaded" instead of displayed, see - https://github.com/qutebrowser/qutebrowser/issues/566[#566]. You can work - around this by using this in your `mailcap`: + For security reasons, local files without `.html` extensions aren't + rendered as HTML, see + https://bugs.chromium.org/p/chromium/issues/detail?id=777737[this Chromium issue] + for details. You can do this in your `mailcap` file to get a proper + extension: + ---- - text/html; mv %s %s.html && qutebrowser %s.html >/dev/null 2>/dev/null; needsterminal; + text/html; qutebrowser %s; nametemplate=%s.html ---- What is the difference between bookmarks and quickmarks?:: diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 00481c2f4..333999356 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -32,7 +32,7 @@ import attr from PyQt5.QtCore import pyqtSlot, QObject, Qt, QUrl from PyQt5.QtWidgets import QLabel -from qutebrowser.config import config +from qutebrowser.config import config, configexc from qutebrowser.keyinput import modeman, modeparsers from qutebrowser.browser import webelem from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners @@ -726,6 +726,12 @@ class HintManager(QObject): if mode is None: 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._context = HintContext() diff --git a/qutebrowser/keyinput/macros.py b/qutebrowser/keyinput/macros.py index 08740d80d..97b0b103b 100644 --- a/qutebrowser/keyinput/macros.py +++ b/qutebrowser/keyinput/macros.py @@ -34,12 +34,14 @@ class MacroRecorder: _macro_count: The count passed to run_macro_command for each window. Stored for use by run_macro, which may be called from keyinput/modeparsers.py after a key input. + _last_register: The macro which did run last. """ def __init__(self): self._macros = {} self._recording_macro = None self._macro_count = {} + self._last_register = None @cmdutils.register(instance='macro-recorder', name='record-macro') @cmdutils.argument('win_id', win_id=True) @@ -85,9 +87,16 @@ class MacroRecorder: def run_macro(self, win_id, register): """Run a recorded macro.""" + if register == '@': + if self._last_register is None: + raise cmdexc.CommandError("No previous macro") + register = self._last_register + self._last_register = register + if register not in self._macros: raise cmdexc.CommandError( "No macro recorded in '{}'!".format(register)) + commandrunner = runners.CommandRunner(win_id) for _ in range(self._macro_count[win_id]): for cmd in self._macros[register]: diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index 3a0cb1da0..fd4465daa 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -15,6 +15,10 @@ Feature: Using hints And I hint with args "links normal" and follow xyz 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 Scenario: Following a hint and force to open in current tab. |