diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 63a40103a..fa1dfd729 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -174,6 +174,9 @@ Changed doing so is supported (QtWebEngine 5.15). - If `tabs.favicons.show` is set to `never`, favicons aren't unnecessarily downloaded anymore. +- Renamed commands: + * `run-macro` -> `macro-run` + * `record-macro` -> `macro-record` - Various performance improvements, including for the startup time. Fixed diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 3564c9766..ed4dc362f 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -77,6 +77,8 @@ possible to run or bind multiple commands by separating them with `;;`. |<>|Evaluate a JavaScript string. |<>|Jump to the mark named by `key`. |<>|Execute a command after some time. +|<>|Start or stop recording a macro. +|<>|Run a recorded macro. |<>|Show an error message in the statusbar. |<>|Show an info message in the statusbar. |<>|Show a warning message in the statusbar. @@ -91,13 +93,11 @@ possible to run or bind multiple commands by separating them with `;;`. |<>|Load a quickmark. |<>|Save the current page as a quickmark. |<>|Quit qutebrowser. -|<>|Start or stop recording a macro. |<>|Reload the current/[count]th tab. |<>|Repeat a given command. |<>|Repeat the last executed command. |<>|Report a bug in qutebrowser. |<>|Restart qutebrowser while keeping existing tabs open. -|<>|Run a recorded macro. |<>|Run a command with the given count. |<>|Save configs and state. |<>|Scroll the current tab in the given direction. @@ -797,6 +797,27 @@ Execute a command after some time. * With this command, +;;+ is interpreted literally instead of splitting off a second command. * This command does not replace variables like +\{url\}+. +[[macro-record]] +=== macro-record +Syntax: +:macro-record ['register']+ + +Start or stop recording a macro. + +==== positional arguments +* +'register'+: Which register to store the macro in. + +[[macro-run]] +=== macro-run +Syntax: +:macro-run ['register']+ + +Run a recorded macro. + +==== positional arguments +* +'register'+: Which macro to run. + +==== count +How many times to run the macro. + [[message-error]] === message-error Syntax: +:message-error 'text'+ @@ -991,15 +1012,6 @@ Quit qutebrowser. * +*-s*+, +*--save*+: When given, save the open windows even if auto_save.session is turned off. -[[record-macro]] -=== record-macro -Syntax: +:record-macro ['register']+ - -Start or stop recording a macro. - -==== positional arguments -* +'register'+: Which register to store the macro in. - [[reload]] === reload Syntax: +:reload [*--force*]+ @@ -1052,18 +1064,6 @@ Report a bug in qutebrowser. === restart Restart qutebrowser while keeping existing tabs open. -[[run-macro]] -=== run-macro -Syntax: +:run-macro ['register']+ - -Run a recorded macro. - -==== positional arguments -* +'register'+: Which macro to run. - -==== count -How many times to run the macro. - [[run-with-count]] === run-with-count Syntax: +:run-with-count 'count-arg' 'command'+ diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 41dbd5b73..df886e840 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -599,7 +599,7 @@ Default: * +pass:[<forward>]+: +pass:[forward]+ * +pass:[=]+: +pass:[zoom]+ * +pass:[?]+: +pass:[set-cmd-text ?]+ -* +pass:[@]+: +pass:[run-macro]+ +* +pass:[@]+: +pass:[macro-run]+ * +pass:[B]+: +pass:[set-cmd-text -s :quickmark-load -t]+ * +pass:[D]+: +pass:[tab-close -o]+ * +pass:[F]+: +pass:[hint all tab]+ @@ -662,7 +662,7 @@ Default: * +pass:[o]+: +pass:[set-cmd-text -s :open]+ * +pass:[pP]+: +pass:[open -- {primary}]+ * +pass:[pp]+: +pass:[open -- {clipboard}]+ -* +pass:[q]+: +pass:[record-macro]+ +* +pass:[q]+: +pass:[macro-record]+ * +pass:[r]+: +pass:[reload]+ * +pass:[sf]+: +pass:[save]+ * +pass:[sk]+: +pass:[set-cmd-text -s :bind]+ diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index 2a30344cd..b2fd2d47f 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -376,8 +376,7 @@ class CommandRunner(AbstractCommandRunner): if result.cmdline[0] == 'repeat-command': record_last_command = False - if result.cmdline[0] in ['record-macro', 'run-macro', - 'set-cmd-text']: + if result.cmdline[0] in ['macro-record', 'macro-run', 'set-cmd-text']: record_macro = False if record_last_command: diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 026589985..6f417891e 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -3352,8 +3352,8 @@ bindings.default: : tab-pin : tab-mute gD: tab-give - q: record-macro - "@": run-macro + q: macro-record + "@": macro-run tsh: config-cycle -p -t -u *://{url:host}/* content.javascript.enabled ;; reload tSh: config-cycle -p -u *://{url:host}/* content.javascript.enabled diff --git a/qutebrowser/keyinput/macros.py b/qutebrowser/keyinput/macros.py index ee8883070..80fa4825e 100644 --- a/qutebrowser/keyinput/macros.py +++ b/qutebrowser/keyinput/macros.py @@ -52,9 +52,9 @@ class MacroRecorder: self._macro_count: Dict[int, int] = {} self._last_register: Optional[str] = None - @cmdutils.register(instance='macro-recorder', name='record-macro') + @cmdutils.register(instance='macro-recorder') @cmdutils.argument('win_id', value=cmdutils.Value.win_id) - def record_macro_command(self, win_id: int, register: str = None) -> None: + def macro_record(self, win_id: int, register: str = None) -> None: """Start or stop recording a macro. Args: @@ -77,12 +77,10 @@ class MacroRecorder: self._macros[register] = [] self._recording_macro = register - @cmdutils.register(instance='macro-recorder', name='run-macro') + @cmdutils.register(instance='macro-recorder') @cmdutils.argument('win_id', value=cmdutils.Value.win_id) @cmdutils.argument('count', value=cmdutils.Value.count) - def run_macro_command(self, win_id: int, - count: int = 1, - register: str = None) -> None: + def macro_run(self, win_id: int, count: int = 1, register: str = None) -> None: """Run a recorded macro. Args: diff --git a/tests/end2end/features/keyinput.feature b/tests/end2end/features/keyinput.feature index 0e344947d..2b86605f2 100644 --- a/tests/end2end/features/keyinput.feature +++ b/tests/end2end/features/keyinput.feature @@ -76,12 +76,12 @@ Feature: Keyboard input # Macros Scenario: Recording a simple macro - When I run :record-macro + When I run :macro-record And I press the key "a" And I run :message-info "foo 1" And I run :message-info "bar 1" - And I run :record-macro - And I run :run-macro with count 2 + And I run :macro-record + And I run :macro-run with count 2 And I press the key "a" Then the message "foo 1" should be shown And the message "bar 1" should be shown @@ -91,11 +91,11 @@ Feature: Keyboard input And the message "bar 1" should be shown Scenario: Recording a named macro - When I run :record-macro foo + When I run :macro-record foo And I run :message-info "foo 2" And I run :message-info "bar 2" - And I run :record-macro foo - And I run :run-macro foo + And I run :macro-record foo + And I run :macro-run foo Then the message "foo 2" should be shown And the message "bar 2" should be shown And the message "foo 2" should be shown @@ -104,7 +104,7 @@ Feature: Keyboard input Scenario: Running an invalid macro Given I open data/scroll/simple.html And I run :tab-only - When I run :run-macro + When I run :macro-run And I press the key "b" Then the error "No macro recorded in 'b'!" should be shown And no crash should happen @@ -112,34 +112,34 @@ Feature: Keyboard input Scenario: Running an invalid named macro Given I open data/scroll/simple.html And I run :tab-only - When I run :run-macro bar + When I run :macro-run bar Then the error "No macro recorded in 'bar'!" should be shown And no crash should happen Scenario: Running a macro with a mode-switching command When I open data/hints/html/simple.html - And I run :record-macro a + And I run :macro-record a And I run :hint links normal And I wait for "hints: *" in the log And I run :leave-mode - And I run :record-macro a - And I run :run-macro + And I run :macro-record a + And I run :macro-run And I press the key "a" And I wait for "hints: *" in the log Then no crash should happen Scenario: Cancelling key input - When I run :record-macro + When I run :macro-record And I press the key "" Then "Leaving mode KeyMode.record_macro (reason: leave current)" should be logged Scenario: Ignoring non-register keys - When I run :record-macro + When I run :macro-record And I press the key "" And I press the key "c" And I run :message-info "foo 3" - And I run :record-macro - And I run :run-macro + And I run :macro-record + And I run :macro-run And I press the key "c" Then the message "foo 3" should be shown And the message "foo 3" should be shown