Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected extra commands included at start of macro #5781

Closed
sbates-idrc opened this issue Dec 14, 2022 · 6 comments · Fixed by SublimeText/CTags#342
Closed

Unexpected extra commands included at start of macro #5781

sbates-idrc opened this issue Dec 14, 2022 · 6 comments · Fixed by SublimeText/CTags#342
Assignees
Milestone

Comments

@sbates-idrc
Copy link

Description of the bug

Sometimes (I haven't been able to figure out how to reproduce 100% reliably) I am seeing extra commands that I don't expect when I create a macro.

Steps to reproduce

  1. Start ST in safe mode
  2. Open the file at: https://gist.github.com/sbates-idrc/2eb855e3e4f220c204a189f01349e04c
  3. Go to line 507
  4. Position the caret just before the first text on the line ("C1")
  5. Create the macro
    • Ctrl+Q
    • Ctrl+D
    • Ctrl+C
    • Ctrl+V
    • :
    • [space]
    • '
    • Ctrl+V
    • '
    • ,
    • Ctrl+K, Ctrl+K
    • [down arrow]
    • [home]
    • Ctrl+Q
  6. Observe how many commands are reported in the macro on the status bar
  7. The macro above should have 10 commands, and sometimes I get 10 commands; however other times I get a number greater than 10; if you get 10 commands, play the macro a few times, use undo to get back the starting file, move the caret around the file and then repeat steps 3-6 (recreating the macro) until you get a number other than 10
  8. Save the macro file

Expected behavior

A macro of 10 commands:

[
        {
                "args": null,
                "command": "find_under_expand"
        },
        {
                "args": null,
                "command": "copy"
        },
        {
                "args": null,
                "command": "paste"
        },
        {
                "args":
                {
                        "characters": ":"
                },
                "command": "insert"
        },
        {
                "args":
                {
                        "characters": " '"
                },
                "command": "insert"
        },
        {
                "args": null,
                "command": "paste"
        },
        {
                "args":
                {
                        "characters": "',"
                },
                "command": "insert"
        },
        {
                "args":
                {
                        "file": "res://Packages/Default/Delete to Hard EOL.sublime-macro"
                },
                "command": "run_macro_file"
        },
        {
                "args":
                {
                        "by": "lines",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "extend": false,
                        "to": "bol"
                },
                "command": "move_to"
        }
]

Actual behavior

Sometimes, I get unexpected extra commands at the start. For example, this is what I got one of the times:

[
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "lines",
                        "forward": false
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "lines",
                        "forward": false
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "by": "characters",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args": null,
                "command": "find_under_expand"
        },
        {
                "args": null,
                "command": "copy"
        },
        {
                "args": null,
                "command": "paste"
        },
        {
                "args":
                {
                        "characters": ":"
                },
                "command": "insert"
        },
        {
                "args":
                {
                        "characters": " '"
                },
                "command": "insert"
        },
        {
                "args": null,
                "command": "paste"
        },
        {
                "args":
                {
                        "characters": "',"
                },
                "command": "insert"
        },
        {
                "args":
                {
                        "file": "res://Packages/Default/Delete to Hard EOL.sublime-macro"
                },
                "command": "run_macro_file"
        },
        {
                "args":
                {
                        "by": "lines",
                        "forward": true
                },
                "command": "move"
        },
        {
                "args":
                {
                        "extend": false,
                        "to": "bol"
                },
                "command": "move_to"
        }
]

Sublime Text build number

4143

Operating system & version

Windows 10

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

@BenjaminSchaaf BenjaminSchaaf self-assigned this Dec 15, 2022
@BenjaminSchaaf
Copy link
Member

I was unable to reproduce this after 10 tries of following the provided steps. Has this happened more than once?

@sbates-idrc
Copy link
Author

I am able to reproduce multiple times. I just captured a video where I get 10 commands for the first macro recording (after opening ST in safe mode and then opening the Worlds.js file) and then 44 commands for the second time. Between the first and second, I ran the macro a few times, then used undo to get back to the original file state, moved the caret around, and then started recording again.

2022-12-15.09-46-51.mp4

@sbates-idrc
Copy link
Author

Here is the macro saved from the above video: https://gist.github.com/sbates-idrc/3468bbd3d16711a4d5afc298de2cd709

@BenjaminSchaaf
Copy link
Member

Did this happen in previous releases of ST?

@sbates-idrc
Copy link
Author

sbates-idrc commented Dec 16, 2022

This is the first time that I have experienced this issue. However, while I have been using Sublime Text for many years, I have used the macro recording feature very little. I had been thinking recently that I'd like to learn how to use macro recording for repetitive text editing and I had a case where I could use it this week. And then I encountered this issue. I can't say with confidence that this issue was not present on previous versions as I haven't tried to use macro recording much until this week.

@BenjaminSchaaf
Copy link
Member

Fixed in build 4147.

@BenjaminSchaaf BenjaminSchaaf added this to the Build 4147 milestone Dec 22, 2022
deathaxe added a commit to SublimeText/CTags that referenced this issue Aug 11, 2023
Fixes #341

This commit converts `RebuildTags` into a `WindowCommand` so it keeps working
when used in sidebar context menu.

This change is required as ST4147+ restricts `TextCommand` usage
to fix sublimehq/sublime_text#5781.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants