[vim/vim] fix(edit): stale Insstart after <Cmd> cursor move breaks undo (PR #20031)

1 view
Skip to first unread message

Jaehwang Jung

unread,
12:28 PM (3 hours ago) 12:28 PM
to vim/vim, Subscribed

Problem:
A <Cmd> command executed from Insert mode can sync undo and move the cursor before the next edit. stop_arrow() saved the new cursor line for undo, but left Insstart at the previous insertion point. A line-start backspace could then delete lines above the saved line without saving the joined range, leaving a pending undo entry whose bottom resolved above its top and triggering an internal undo error.

Solution:
Update Insstart and Insstart_textlen after the pending undo save so the next edit starts from the command-updated cursor position.

AI-assisted: Codex

I gave Codex this bug in nvim L3MON4D3/LuaSnip#1248, and it found the minimal reproducer and the patch.


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

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

Commit Summary

  • 80f62b6 fix(edit): stale Insstart after <Cmd> cursor move breaks undo

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/20031@github.com>

Christian Brabandt

unread,
3:21 PM (1 hour ago) 3:21 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20031)

thanks


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

Christian Brabandt

unread,
3:26 PM (26 minutes ago) 3:26 PM
to vim/vim, Subscribed

Closed #20031 via d4fb317.


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

Reply all
Reply to author
Forward
0 new messages