`gj` goes to the beginning of shorter lines only in .cs files
Describe the bug Yeah, this is one of those. Given two lines in a C# source file:
class C
{
public static void Main()
{
Console.WriteLine("Hello world") /* Cursor here */;
}
}
Pressing j on the WriteLine line towards the end moves the cursor to beginning of the line, as if I had pressed j0 and not just j. This only reproduces in .cs files. Not in .vb files or .vsvimrc files as far as I can tell. It's also not a 2.8 regression: I tested with 2.7 to be sure. My guess is it's a 16.4 regression. I'm currently running 16.4.2.
To Reproduce Steps to reproduce the behavior:
- Create a new C# project
- Click on a line longer than the one below it.
- Hit
j - Cursor moves as if
j0has been hit.
Environment (please complete the following information):
Edit: I do have
nnoremap j gj
nnoremap k gk
In my vsvimrc, and this issue does seem to go away when I remove them.
- Visual Studio version: 16.4.2
- VsVim version: 2.8.0.0 (but also reproduces in 2.7.0.0)
- Programming Language: C# (important!)
- Check(Type 'x') any that are installed:
- [ ] ReSharper
- [ ] Visual Assist
Did some quick debugging on my machine and found the following:
- The setting
wrapmust be enabled to see this behavior. - The bug reproduces on all file types. Specifically tested
.csand.txt. @333fred possible thatwrapis disabled in.txtfiles and hence why you only see the behavior in.cs? - The bug is in the motion logic, not caret movement. That is if you test by executing
ygjyou will see the behavior outlined in the bug report in the yanked text. - This will repro when the caret in the start line is longer than the destination line and the caret is inside the portion of the line that doesn't exist in the destination.
@jaredpar I didn't test with txt files, just cs, vb, and (vs) vimrc.
@jaredpar I'm having this issue as well, but I cannot reproduce it when running VimApp from source! I want to check if I can reproduce it from source for VsVim2022, but I can't seem to build that project.