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

Cursor is one column off after leaving multi-cursor mode #3775

trkoch opened this issue May 16, 2019 · 2 comments


None yet
1 participant
Copy link

commented May 16, 2019

Describe the bug
When in multi-cursor mode, pressing escape twice to return to normal mode leaves cursor one column to the left.

To Reproduce
Steps to reproduce the behavior:

  1. Given the text
  1. With cursor at n
  1. Enable multi-cursor mode by pressing cmd+d
  2. Leave multi-cursor mode py pressing esc, esc
  3. Cursor is at

Expected behavior
Ideally cursor should be were it was before entering multi-cursor mode.

With regards to the example given above, I expect the cursor to be at.


Cursor before leaving multi-cursor mode


Cursor after leaving multi-cursor mode


Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.8.0
  • VSCode version: 1.33.1
  • OS: macOS

This comment has been minimized.

Copy link

commented May 16, 2019

I tracked down this line

vimState.cursors = => x.withNewStop(x.stop.getLeft()));

Removing getLeft() seems to have the desired effect (i.e. expected cursor position after leaving multi-cursor mode). However, I'm pretty sure it is there for a reason?

diff --git a/src/actions/commands/actions.ts b/src/actions/commands/actions.ts
index 4e8da5b5..3a045ff5 100644
--- a/src/actions/commands/actions.ts
+++ b/src/actions/commands/actions.ts
@@ -543,7 +543,7 @@ class CommandEsc extends BaseCommand {
       // as that is handled for you by the state machine. ESC is
       // a special case since runsOnceForEveryCursor is false.
-      vimState.cursors = => x.withNewStop(x.stop.getLeft()));
+      vimState.cursors = => x.withNewStop(x.stop));
     if (vimState.currentMode === ModeName.SearchInProgressMode) {

This comment has been minimized.

Copy link

commented May 17, 2019

However, I'm pretty sure it is there for a reason?

When exiting insert mode, both VSCode and Vim shift the cursor one column to the left (e.g. i, <esc>) so I'm guessing that's why it's done here as well. However, I believe this to be an error and inconsistent with visual mode. When exiting visual mode, the cursor stays at the position. Since multi-cursor mode seems to be a variation of the visual mode (as indicated in the status bar), I suggest to match its reset behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.