[vim/vim] fix: inconsistent cursor encoding past EOL with virtualedit=all (PR #19009)

1 view
Skip to first unread message

mcauley-penney

unread,
5:33 PM (3 hours ago) 5:33 PM
to vim/vim, Subscribed

PROBLEM:
When virtualedit is set to all, the cursor is supposed to be permitted to reside anywhere, including oin the virtual space beyond the end of the buffer's text. Switching modes triggered a routine that "fixed" a cursor that was past the end of the line by shifting it back to the last actual character in the line and compensating with a virtual column offset. While visually identical, this re-encoding changed the underlying byte index, causing position-reporting functions to return inconsistent values after a mode change.

SOLUTION:
Skip this coordinate adjustment when virtual editing is fully enabled. By treating the line terminator as a valid, stable position, the cursor’s internal representation remains unchanged when entering or exiting Visual mode, ensuring consistent coordinate reporting. Add a regression test to check this functionality.

Closes #16276


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19009

Commit Summary

  • 9992c62 fix: inconsistent cursor encoding past EOL with virtualedit=all

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19009@github.com>

Reply all
Reply to author
Forward
0 new messages