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

Insert-Normal Mode moves cursor by one #1293

Closed
xlaech opened this issue Feb 13, 2017 · 9 comments
Closed

Insert-Normal Mode moves cursor by one #1293

xlaech opened this issue Feb 13, 2017 · 9 comments

Comments

@xlaech
Copy link
Contributor

xlaech commented Feb 13, 2017

What did you do?

In Insert Mode i pressed <C-o> to go to Insert normal Mode.
The Commands i use in there work, but when i come back to normal mode, the cursor has moved one character to the left.

What did you expect to happen?

I expected the cursor to stay at the old position (checked the behavior in vim 8.0)

What happened instead?

The Cursor moved one character to the left.

Technical details:

  • VSCode Version: 1.9
  • VsCodeVim Version: 0.5.3
  • OS: Mac OS X Sierra 10.12.3
@xconverge
Copy link
Member

Ooo good one, this makes c-o pretty weird to use! I will try to get to this tonight, should be easy

@xconverge
Copy link
Member

Also note of the edge case of the first char on the line...this currently acts correctly for the first character

@xlaech
Copy link
Contributor Author

xlaech commented Feb 14, 2017

I just checked out the code myself and realized, that the bug is much more general. It is caused whenever i leave the insert mode with Esc. Since ctrl-o will call new CommandEscInsertMode().exec(position, vimState); @actions.ts, it triggers the bug.

@xconverge
Copy link
Member

xconverge commented Feb 14, 2017

That isn't a bug though, that is the intended behavior of Esc when in insert, right?

@xlaech
Copy link
Contributor Author

xlaech commented Feb 14, 2017

Oh... I see. I just checked in vim 8.0. So i would love to fix the bug (already got it working locally), but i want to keep your style of coding.

  1. is position.getLeft().add(new PositionDiff(0, 1)); the right way to go?
  2. would this be important enough to overload the method?

@xlaech
Copy link
Contributor Author

xlaech commented Feb 14, 2017

Ah i see. I can just pass in another parameter :)
Is it ok if I create a pull request?

@xconverge
Copy link
Member

@xlaech Yes of course! just tag this issue in your commit message with "fixes #1293"

I think it is even easier though. Can't we just do this only for Ctrl+o

new CommandEscInsertMode().exec(position.getRight(), vimState);

instead of new CommandEscInsertMode().exec(position, vimState); as long is it is not the first character?

xlaech added a commit to xlaech/Vim that referenced this issue Feb 14, 2017
@johnfn
Copy link
Member

johnfn commented Feb 15, 2017

Wonderful, @xlaech! Always glad to see more people contributing.

You can also feel free to ping me on our slack channel for faster responses. I'm on vacation currently, but I'll try my best to help when I can!

@xlaech
Copy link
Contributor Author

xlaech commented Feb 15, 2017

Ok. thank you.

@johnfn johnfn closed this as completed in 4f1cafa Feb 15, 2017
johnfn added a commit that referenced this issue Feb 15, 2017
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

No branches or pull requests

3 participants