sublime-text-plugin icon indicating copy to clipboard operation
sublime-text-plugin copied to clipboard

After Running Wrap with Abbreviation, Multiple Selections are Lost

Open michaelalandawson opened this issue 4 years ago • 7 comments

Thank you very much for adding multiple selections for Wrap with Abbreviation.

After running the Wrap with Abbreviation command, multiple selections are lost and the caret is located where the end of the top-most selection region was before running the command.

I would like to see each selection remain after running the Wrap with Abbreviation command. This will allow us to continue with multi-selection editing.

michaelalandawson avatar Sep 07 '20 14:09 michaelalandawson

Let me also add to this issue that when using multiple selections, after running the Wrap with Abbreviation command, the carets were located in the appropriate location according to the type of wrapping tag.

For example, if multiple email addresses were selected and wrapped with "a" tags, the carets would be placed in the href="|" attribute.

Currently, this works as expected when using a Wrap with Abbreviation on a single selection region, however, it doesn't work with multiple selection regions.

michaelalandawson avatar Sep 07 '20 15:09 michaelalandawson

@sergeche, the recent commit that adds "multicursor abbreviation expand" is a very nice addition. Thank you for that.

Can it be enhanced so that it retains all cursors after a multi-selection command has completed?

This would include the abbreviations as well as wrap with abbreviation commands.

Thank you again.

michaelalandawson avatar Oct 26 '20 15:10 michaelalandawson

It should retain cursor positions after expand, except tabsops. Can you record a small GIF with example of invalid cursor behaviour?

sergeche avatar Oct 26 '20 15:10 sergeche

As you noted, Emmet does retain multiple cursor positions after expanding multiple abbreviations. However, it does not retain multiple cursors after wrapping with a single abbreviation.

emmet-multi-selection

I also noticed that depending on how the selections were made, the cursor is placed in different locations after the abbreviation is expanded. In the capture, above, the second pair of lines are expanded and the cursor remains at the end of the line 12. When the third pair of lines are expanded, the cursor remains at the end of line 16.

Thank you for looking into this.

michaelalandawson avatar Oct 26 '20 15:10 michaelalandawson

@michaelalandawson Oh, it's wrapping with abbreviation. Will take a look

sergeche avatar Oct 26 '20 17:10 sergeche

Fixed multiple cursors in v2.2.4, please check if it works as expected

sergeche avatar Oct 27 '20 08:10 sergeche

@sergeche, it works perfectly. Thank you for fixing this.

michaelalandawson avatar Oct 27 '20 13:10 michaelalandawson