Steps to reproduce
In a sandbox vault, turn on vim mode and type one long paragraph with no newlines. Make sure word wrapping occurs. It should be enough to demonstrate the issue if the paragraph spans 4 wrapped lines. For a narrow enough window, the following paragraph works:
Aaaaaaaaaa Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb Ccccccccccccccccccccccc Ddddddddddddddddddddddddddddddd
Make sure that the window is too narrow to accomodate more than one word per line, but wide enough to prevent individual words from being broken over two lines.
- In normal mode, put the cursor at the start of the 3rd line.
- Press
i
. Now the cursor is at the start of the 3rd line in insert mode. - Press the up arrow key.
The expected behaviour is that the cursor jumps to the start of line 2. The actual behaviour is that the cursor actually jumps to the character in line 1 immediately above the last character of line 2. If line 2 is longer than line 1, it jumps to the last character of line 1. - In normal mode, put the cursor at the start of the 3rd line.
- Press
i
. Now the cursor is at the start of the 3rd line in insert mode. - Press the down arrow key.
The expected behaviour is that the cursor jumps to the start of the 4th line. The actual behaviour is that the cursor actually jumps to the character in line 3 immediately below the last character of line 2. If line 2 is longer than line 3, it jumps to the last character of line 3.
(Also, similar weird behaviour exists with the gk
command with the cursor at the start of a wrapped line.)
Did you follow the troubleshooting guide?
Yes
Expected result
At step 3, the cursor should jump to the start of line 2.
At step 6, the cursor should jump to the start of the 4th line,
Actual result
At step 3, the cursor actually jumps to the character in line 1 immediately above the last character of line 2. If line 2 is longer than line 1, it jumps to the last character of line 1.
At step 6, the cursor actually jumps to the character in line 3 immediately below the last character of line 2. If line 2 is longer than line 3, it jumps to the last character of line 3.
Environment
SYSTEM INFO:
Obsidian version: v1.6.7
Installer version: v1.5.11
Operating system: Windows 10 Pro 10.0.22631
Login status: not logged in
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on
RECOMMENDATIONS:
none
Additional information
It doesn’t seem like it matters how the cursor gets to the start of the 3rd line, as long as it happens in normal mode. It also behaves like this if you put the cursor at the end of line 2 and press a such that you enter insert mode with the cursor at the start of line 3.
This seems like a bug from an older version of codemirror, since fixed; see fix broken arrow navigation on wrapped lines by nightwing · Pull Request #170 · replit/codemirror-vim · GitHub and the issues mentioned therein.