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

Fix cursor off after leaving multi-cursor mode #4237

Merged
merged 1 commit into from
Dec 29, 2019

Conversation

trkoch
Copy link
Contributor

@trkoch trkoch commented Nov 3, 2019

What this PR does / why we need it:
Previously when leaving multi-cursor mode with <Esc> the cursor would move one column to the left. For instance, when triggering multi-cursor mode on a single word, the cursor would end at the second to last character. While this is expected behavior when leaving insert mode, it is not for visual mode (which multi-cursor mode is based on). To fix, remove special case handling altogether.

Which issue(s) this PR fixes:
#3775

Special notes for your reviewer:
After giving it some thoughts, I decided to remove the special case completely. I could not reproduce any other case where conditions would match other than move-left after multi-cursor mode. To verify, I added a console.log() in the branch in question, and ran the complete test suite. Only one test wrote a message to the console (the one I changed to expected behavior).

@trkoch
Copy link
Contributor Author

trkoch commented Nov 3, 2019

Deleted code was introduced with 2cdc557.

@trkoch
Copy link
Contributor Author

trkoch commented Nov 15, 2019

Any objections?

@stevenguh
Copy link
Contributor

Maybe @jpoon knows more about this code. Also, should we have a specific unit test for this case you are trying to fix?

@trkoch
Copy link
Contributor Author

trkoch commented Nov 20, 2019

It seems this case was not covered by a test, so in order to guard against regressions, adding a test may be good idea. However I did not add new functionality but rather removed (apparently) misbehaving code.

@J-Fields
Copy link
Member

I agree - there doesn't seem to be any reason why exiting visual mode with multiple cursors would act differently than with only one.

Previously when leaving multi-cursor mode with <Esc> the cursor would
move one column to the left. For instance, when triggering multi-cursor
mode on a single word, the cursor would end at the second to last
character. While this is expected behavior when leaving insert mode, it
is not for visual mode (which multi-cursor mode is based on). To fix,
remove special case handling altogether.

Fixes VSCodeVim#3775.
@J-Fields J-Fields force-pushed the fix-cursor-off-multi branch from fc348d2 to db75197 Compare December 29, 2019 05:04
Copy link
Member

@J-Fields J-Fields left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'll merge once the tests finish and look green. Thank you!

@J-Fields J-Fields merged commit 623cb57 into VSCodeVim:master Dec 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants