VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.73k stars 1.31k forks source link

fix #4912 broken H and L motions #9150

Closed rpuhalovich closed 1 month ago

rpuhalovich commented 1 month ago

What this PR does / why we need it: Fixes H and L behavior to be faithful to how vanilla Vim behaves. Prior to this, H and L would jump to the top and bottom visible lines in the editor, not respecting the editor.cursorSurroundingLines (scrolloff in vanilla Vim) setting. It would also move the cursor to the first non whitespace character on the line (either backwards or forwards) which was not faithful to vanilla Vim.

It also fixes tests that were written with the assumption of this incorrect behavior.

Which issue(s) this PR fixes Fixes #4912 and #8837.

Special notes for your reviewer: Let me know if you'd like more tests written.

Edit: Oops. After checking :h M looks like what I said about allowing the cursor to land on a white space character was incorrect. Have reverted the test changes and added functionality to allow this behavior.

rpuhalovich commented 1 month ago

Thanks for the approval @J-Fields, will this branch be merged into master?

J-Fields commented 1 month ago

Sorry, I'd meant to merge yesterday but must've gotten distracted