Rename :run-macro and :record-macro

See #6022
This commit is contained in:
Florian Bruhin 2021-01-20 14:22:30 +01:00
parent 673c0be179
commit 487f90443c
7 changed files with 50 additions and 50 deletions

View File

@ -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

View File

@ -77,6 +77,8 @@ possible to run or bind multiple commands by separating them with `;;`.
|<<jseval,jseval>>|Evaluate a JavaScript string.
|<<jump-mark,jump-mark>>|Jump to the mark named by `key`.
|<<later,later>>|Execute a command after some time.
|<<macro-record,macro-record>>|Start or stop recording a macro.
|<<macro-run,macro-run>>|Run a recorded macro.
|<<message-error,message-error>>|Show an error message in the statusbar.
|<<message-info,message-info>>|Show an info message in the statusbar.
|<<message-warning,message-warning>>|Show a warning message in the statusbar.
@ -91,13 +93,11 @@ possible to run or bind multiple commands by separating them with `;;`.
|<<quickmark-load,quickmark-load>>|Load a quickmark.
|<<quickmark-save,quickmark-save>>|Save the current page as a quickmark.
|<<quit,quit>>|Quit qutebrowser.
|<<record-macro,record-macro>>|Start or stop recording a macro.
|<<reload,reload>>|Reload the current/[count]th tab.
|<<repeat,repeat>>|Repeat a given command.
|<<repeat-command,repeat-command>>|Repeat the last executed command.
|<<report,report>>|Report a bug in qutebrowser.
|<<restart,restart>>|Restart qutebrowser while keeping existing tabs open.
|<<run-macro,run-macro>>|Run a recorded macro.
|<<run-with-count,run-with-count>>|Run a command with the given count.
|<<save,save>>|Save configs and state.
|<<scroll,scroll>>|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'+

View File

@ -599,7 +599,7 @@ Default:
* +pass:[&lt;forward&gt;]+: +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]+

View File

@ -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:

View File

@ -3352,8 +3352,8 @@ bindings.default:
<Ctrl-p>: tab-pin
<Alt-m>: 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

View File

@ -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:

View File

@ -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 "<Escape>"
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 "<Menu>"
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