Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Do not revert to a single cursor when escape is pressed after a block selection

Open lord opened this issue 2 years ago • 5 comments

What this PR does / why we need it: Previously, if you created a multicursor block selection, pressed I, and then pressed escape, all selections except the first would be deleted. This change updates the escape behavior to preserve these selections.

I've also added tests that confirm this behavior is fixed, and confirmed running the tests without the fix makes them fail.

I'll admit I don't perfectly understand the purpose of isFakeMultiCursor, but I'm absolutely willing to put time into changes or improvements as suggested by a reviewer.

Which issue(s) this PR fixes Fixes #8147 Fixes #7008

Special notes for your reviewer: n/a

lord avatar Jul 21 '23 12:07 lord

I'll admit I don't perfectly understand the purpose of isFakeMultiCursor, but I'm absolutely willing to put time into changes or improvements as suggested by a reviewer.

I think the context is this: vanilla Vim doesn't support multicursor, but some actions had effects that sort of mimicked it (like insertion from VisualBlock mode, as this PR relates to). Changing these to be real multi-cursor interactions is much nicer, of course, but this breaks Vim compatibility slightly, as one <Esc> won't take you from multi-cursor Insert to single-cursor Normal. isFakeMultiCursor tracks these situations so one <Esc> will also collapse the cursors.

I do wonder if all this isn't nitpicky bullshit that we can just do away with.

J-Fields avatar Aug 29 '23 01:08 J-Fields

I could add a configuration option that defaults to getting rid of isFakeMultiCursor. That way users who expect and depend on the old behavior would instantly see it break, and, if they complain, we can mention this configuration option as a way to get back to the old behavior. If they don't complain, then it's unlikely folks are dependent on this old behavior, and we can get rid of it?

lord avatar Aug 29 '23 11:08 lord

Any progress with this PR? Adding a configuration seems like a good idea to me.

musjj avatar Apr 23 '24 16:04 musjj

Also, another behavior I'm noticing: when deleting in a block selection (e.g. <C-v>jjjdf), the multi cursors will revert to a single cursor. Can we also add an option for this too?

musjj avatar Apr 24 '24 14:04 musjj