Sublime Forum

Multi_cursor_at_end.sublime-macro not working when multiple cursors exist

#1

In ST3 I used this macro to prepend a line with a dot:

[
	{
		"args": null,
		"command": "split_selection_into_lines"
	},
	{
		"args":
		{
			"to": "bol"
		},
		"command": "move_to"
	},
	{
		"args":
		{
			"characters": "."
		},
		"command": "insert"
	}
]

Now in ST4 the behaviour of the macro has changed:

in ST3, I could use this macro for two things:

  1. invoking this macro, several selected lines would be prepended with a dot before the first character of the line (not before the first whitespace).
  2. when I had multiple cursors each before the first character of the line (where I left of after point 1, just erasing the dot), invoking this macro I could put a dot before the first whitespace character of each line.

Now in ST4, the functionality of piont 1. ist preserved.
However piont 2 is not.

I tried to isolate the bug. It has to do with the behaviour of this macro and hence with the command ‘split_selection_into_lines’:

[
	{
		"args":
		{
			"file": "Packages/User/macros/multi_cursor_at_end.sublime-macro"
		},
		"command": "run_macro_file"
	},
]

Using this macro in ST4, the behaviour is as expected when multiple lines are selected but without multiple cursors.

However, when multiple cursors are present, using this macro resuts in that all the cursors are combined into the first one.

0 Likes

#2

The only difference I see between ST3 and 4 here is that split_selection_into_lines deselects empty lines, otherwise it’s behaving as you described. This is using build 4160:

Screencast%20from%202023-10-23%2016-39-54

0 Likes