You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When pressing = on build 4143 this works as expected and macro recording begins. Ending the recording with toggle_record_macro or by using the menu option also works as expected.
In 4150 however, pressing = causes the status bar to display "Starting to record macro..." but no macro recording actually appears to occur. Running "toggle_record_macro" or "stop_record_macro" and then getting the macro with sublime.get_macro() returns an empty array.
The menu bar "Tools -> Record Macro" option appears to work correctly in 4150, as does running "toggle_record_macro" from a keybinding, as does running view.run_command("toggle_record_macro") from the debug console.
Steps to reproduce
Option 1:
Start ST in Safe Mode
Create a TestRecMac.py plugin with the contents above.
Create a keybinding to run the command like above.
Press = in a file to start recording a macro. Observe the "Starting to record macro..." text in the status bar.
Observe that a macro isn't recording by opening the Tools menu and noting the "Record Macro" menu option is available rather than the "Stop Recording Macro" menu option. Or observe that a macro isn't recording by pressing = again and seeing the "Starting to record macro..." text appear in the status bar again, rather than the "Recorded macro with n commands" text.
Option 2:
Start ST in Safe Mode
Enable the Vintage plugin
Attempt to record a macro by entering command mode and pressing
qq (Record macro into the q register [the status bar displays "Starting to record macro..." but it doesn't appear to actually be recording a macro. Check Tools -> Record Macro, or continue to verify.])
x (delete character under cursor)
q (Stop recording macro. [Since no macro is actually being recorded, this doesn't work. Note that the status bar does not display "Recorded macro with n commands"])
@q (Run the macro in the q register. No macro was recorded, so this does not work.)
Expected behavior
Macros should record.
Actual behavior
Macros do not record.
Sublime Text build number
Fails in 4150, works in 4143
Operating system & version
Void Linux, Kernel 6.3.12
(Linux) Desktop environment and/or window manager
bspwm
Additional information
No response
OpenGL context information
No response
The text was updated successfully, but these errors were encountered:
Jayshua
changed the title
toggle_record_macro and start_record_macro commands don't work when run from a plugin
In dev build, toggle_record_macro and start_record_macro commands don't work when run from a plugin
Jul 30, 2023
Macro recording is based on the undo/redo stack. TextCommands are for making text buffer modifications and thus their actions are recorded on the undo/redo stack. Because of this you can't start recording a macro inside of a TextCommand. You'll need to use a WindowCommand or ApplicationCommand.
Thank you, three questions if you have a moment: This is a breaking change since it used to work, right? I couldn't find a comment about this change in the release notes, should it/is it included in those somewhere? Since the Vintage plugin uses TextCommands to implement macro recording, it's now broken and needs to be updated for the new API expectations, correct?
It's a breaking change in the sense of https://xkcd.com/1172/. Starting recording a macro inside a text command leads to broken behavior: #5781.
Since the Vintage plugin uses TextCommands to implement macro recording, it's now broken and needs to be updated for the new API expectations, correct?
Description of the bug
I've written this plugin:
and added this keybinding:
When pressing = on build 4143 this works as expected and macro recording begins. Ending the recording with toggle_record_macro or by using the menu option also works as expected.
In 4150 however, pressing = causes the status bar to display "Starting to record macro..." but no macro recording actually appears to occur. Running "toggle_record_macro" or "stop_record_macro" and then getting the macro with
sublime.get_macro()
returns an empty array.The menu bar "Tools -> Record Macro" option appears to work correctly in 4150, as does running "toggle_record_macro" from a keybinding, as does running
view.run_command("toggle_record_macro")
from the debug console.Steps to reproduce
Option 1:
Option 2:
Expected behavior
Macros should record.
Actual behavior
Macros do not record.
Sublime Text build number
Fails in 4150, works in 4143
Operating system & version
Void Linux, Kernel 6.3.12
(Linux) Desktop environment and/or window manager
bspwm
Additional information
No response
OpenGL context information
No response
The text was updated successfully, but these errors were encountered: