vim-markdown icon indicating copy to clipboard operation
vim-markdown copied to clipboard

Cursor position lost when moving from long lines to shorter lines

Open Bekaboo opened this issue 1 year ago • 0 comments

Hi, thanks for your great work on this plugin!

I noticed a bug: when I move from a long line with cursor at, say, column 10, to a shorter line with length less than 10, the memorized largest horizontal cursor position will be "reset" to the horizontal position of the cursor on the shorter line, and will never come back to 10 after if the cursor is moved to a longer line.

To better explain the difference between the expected (default) behavior and the actual behavior, I make two screen recordings:

  • Expected behavior:

    https://user-images.githubusercontent.com/76579810/229223219-3f926c75-dbf2-4a0f-a535-94c61328efd5.mp4

  • Actual behavior:

    https://user-images.githubusercontent.com/76579810/229223330-3b4044dd-3921-4628-b3f1-5fb3b77ef7a4.mp4

My suggestion is that it might be problem from setting window options on event CursorMoved, this can be considered as a vim bug, but currently it is possible to be effectively fixed by using winsaveview() and vinresetview(), to see why, please check the discussions here.

Bekaboo avatar Mar 31 '23 20:03 Bekaboo