Fixed #64679 - Delete Lines now works with multiple selections on multiple lines#67287
Fixed #64679 - Delete Lines now works with multiple selections on multiple lines#67287alexdima merged 3 commits intomicrosoft:masterfrom
Conversation
b80c785 to
1dc241a
Compare
alexdima
left a comment
There was a problem hiding this comment.
A few things that are not 100% good:
editor.executeEditsis invoked with an empty array of edits, effectively acting as if it were a call toeditor.setSelections.- After running this action, we are now always going to 1 cursor. This is not good, e.g. when having one cursor per line -- I would expect to have here 3 cursors at the end:
| Before | After |
|---|---|
![]() |
![]() |
Also, another case that is not great is when having two clusters of multiple cursors -- I would expect to have here 2 cursors at the end:
All in all, tweaking the resulting selection is not the approach I would take. I would generate IIdentifiedSingleEditOperation and drop the entire DeleteLinesCommand, i.e. I would loop over all selections, and collect all lines to be deleted. I would make sure to dedup them (like a set reunion) and then issue clear edits that never overlap. I would then insert a cursor under each such deletion.
|
Thanks for the feedback, I'll go back and make the appropriate changes |
1dc241a to
cddb02d
Compare
|
👍 Thank you! It was almost perfect, I just needed to add some accounting for the deleted lines in establishing the resulting cursor selection. |





This PR fixes #64679.
It now collapses all cursors:

Also, now deletes multiple lines with multiple selections:

Thanks for considering this request.