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

Up/down motion with gj and gk does not retain cursor position #1675

Closed
o-lim opened this issue May 8, 2017 · 2 comments
Closed

Up/down motion with gj and gk does not retain cursor position #1675

o-lim opened this issue May 8, 2017 · 2 comments

Comments

@o-lim
Copy link

o-lim commented May 8, 2017

  • Click thumbs-up 👍 on this issue if you want it!
  • Click confused 😕 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


BUG REPORT

Environment:

  • VSCode Version: 1.12.x
  • VsCodeVim Version: 0.7.0
  • OS: Linux

What happened:

  • Remap navigation keys j and k to gj and gk respectively via:
{
    "vim.otherModesKeyBindingsNonRecursive": [{
         "before": ["j"],
         "after": ["g", "j"]
     }, {
         "before": ["k"],
         "after": ["g", "k"]
    }]
}
  1. Go to the first line of a series of non-wrapped lines of text, say something like:
void foobar() {
  if (condition) {
    value = a;
  } else {
    value = b;
  }
}
  1. Move cursor to somewhere in middle of the line, say column position 10
  2. Staying in normal mode, press j to move down a line
  3. Keep pressing j to keep moving down several lines
  4. As soon as you hit a line that has fewer characters than where your cursor column position is, the column position gets reset to the end of the current line

What did you expect to happen:

  • Should behave exactly like j and k navigation for non-wrapped lines
    • When going up/down a line the cursor's column position should be restored to the column position when the up/down (j,k) navigation first occurred, unless the line is too short, in which case it should go to end of line
    • In the above example, the cursor position should stay at column 10 whenever possible
@Chillee
Copy link
Member

Chillee commented May 8, 2017

Haha this is also a duplicate of #1323.

There's an open PR for this (#1561), but it has some issues. The fundamental problem is that vscode doesn't expose wrapped line information to us. It might be fixable, but it'd be quite a bit of work.

@xconverge
Copy link
Member

closing in favor of #1323

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