[vim/vim] WinEnter autocommand may confuse Vim when closing tabpage (PR #18733)

2 views
Skip to first unread message

Christian Brabandt

unread,
Nov 12, 2025, 2:32:11 PM (14 hours ago) Nov 12
to vim/vim, Subscribed

Problem: WinEnter autocommand may confuse Vim when closing tabpage
Solution: Verify that curwin did not change in close_others()

related: #18722


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

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

Commit Summary

  • 46f07f7 WinEnter autocommand may confuse Vim when closing tabpage

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

zeertzjq

unread,
Nov 12, 2025, 5:38:22 PM (11 hours ago) Nov 12
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/window.c:

> @@ -4416,6 +4417,11 @@ close_others(
     for (wp = firstwin; win_valid(wp); wp = nextwp)
     {
 	nextwp = wp->w_next;
+
+	// autocommands messed this one up
+	if (old_curwin != curwin && win_valid(old_curwin))
+	    curwin = old_curwin;

Don't you need to set curbuf = curwin->w_buffer as well?


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/18733/review/3455797847@github.com>

Reply all
Reply to author
Forward
0 new messages