replit / codemirror-vim

Vim keybindings for CM6
https://www.npmjs.com/package/@replit/codemirror-vim
MIT License
268 stars 27 forks source link

`j` in visual mode renders offset to actual line when there is empty lines #171

Closed zzhixin closed 1 month ago

zzhixin commented 3 months ago

Description

If there is empty lines, in visual mode, the cursor renders one line offset to the actual line. codemirror-vim

Expected behavior

In the gif above, after pressing j, the cursor should be at the second line rather than the end of the first line. After pressing 2xj, the cursor should be at the third line rather than the second line.

Although the cursor get right after pressing 3xj, the behavior is weird that the cursor goes 2 lines downward at the last j stroke.

Reproduce

  1. Open sandbox
  2. Delete default content, enter
    
    This is a test.

This is another test.


3. press `ggVjjj`.

### Comment
What is interesting is that in codemirror5, no such bug.