[vim/vim] Cursor wrong after autoindent strip is skipped (PR #20332)

4 views
Skip to first unread message

glepnir

unread,
May 26, 2026, 1:10:10 AM (3 days ago) May 26
to vim/vim, Subscribed

Problem:
cursor lands on the wrong line when a
mapping or autocmd modifies lines during insert and the strip is skipped.

Solution:
Restore cursor to tpos when skipwhite skips the strip, instead of leaving it at end_insert_pos.

cc @kristijanhusak


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

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

Commit Summary

  • ecdcbc7 Cursor wrong after autoindent strip is skipped

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20332@github.com>

h_east

unread,
May 26, 2026, 6:14:08 AM (2 days ago) May 26
to vim/vim, Subscribed
h-east left a comment (vim/vim#20332)

Review comment for test naming

Test function name: drop the z_ prefix

The new test is named Test_z_autoindent_no_strip_cross_line, but the z_
prefix looks unintentional here.

In test_edit.vim the only other z_-prefixed test is
Test_z_edit_insertmode_esc_beeps, where the prefix exists to force the test
to run last. This new test has no such ordering requirement, and its closest
relatives — Test_autoindent_no_strip_after_cmd_setline and
Test_autoindent_no_strip_after_cursorholdi — do not use the prefix.

For consistency with those sibling tests, I'd suggest renaming it to
Test_autoindent_no_strip_cross_line.

Minor: also assert the cursor column

The test checks line('.') but not the column. Adding a column assertion
(e.g. via getcurpos()/col('.')) would make the intended final cursor
position unambiguous and guard a bit more of the restored tpos.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20332/c4543242103@github.com>

glepnir

unread,
May 26, 2026, 6:20:13 AM (2 days ago) May 26
to vim/vim, Push

@glepnir pushed 1 commit.

  • fdffa11 Cursor wrong after autoindent strip is skipped


View it on GitHub or unsubscribe.


Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20332/before/ecdcbc7282d89a280a3a83b86a3bd2990a0ae354/after/fdffa119e79108a8c7c8281579fda23027e882c6@github.com>

h_east

unread,
May 26, 2026, 7:17:34 AM (2 days ago) May 26
to vim/vim, Subscribed
h-east left a comment (vim/vim#20332)

@glepnir
Thanks for addressing the review points; the change is in good shape now.

I'd like to raise one thing about collaboration. Reviewing and reconciling the
specification of a patch is real work, and right now that effort often goes
unacknowledged. A simple "thanks" to the people who help get a change correct
costs nothing and keeps others motivated to keep contributing. I'm raising this
because I'd like the collaboration here to stay healthy, not to single anyone
out.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20332/c4543764901@github.com>

glepnir

unread,
May 26, 2026, 7:21:13 AM (2 days ago) May 26
to vim/vim, Subscribed
glepnir left a comment (vim/vim#20332)

Fair point. appreciate it.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20332/c4543778540@github.com>

h_east

unread,
May 26, 2026, 7:35:28 AM (2 days ago) May 26
to vim/vim, Subscribed
h-east left a comment (vim/vim#20332)

@glepnir Thank you for your understanding.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20332/c4543833373@github.com>

Christian Brabandt

unread,
4:12 PM (1 hour ago) 4:12 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20332)

Thanks all


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20332/c4567812282@github.com>

Reply all
Reply to author
Forward
0 new messages