vim-patch:9.1.0117: Stop split-moving from firing WinNew and WinNewPre autocommands

Problem:  win_splitmove fires WinNewPre and possibly WinNew when moving
          windows, even though no new windows are created.
Solution: don't fire WinNew and WinNewPre when inserting an existing
          window, even if it isn't the current window. Improve the
          accuracy of related documentation. (Sean Dewar)

related: vim/vim#14038

https://github.com/vim/vim/commit/96cc4aef3d47d0fd70e68908af3d48a0dce8ea70

Most of the patch was already ported. This includes the remaining part.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
This commit is contained in:
zeertzjqandSean Dewar committed 2026-01-16 15:55:34 +08:00
1 parent d6e5286d2c
commit 4544cec168
2 files changed
+4 -3

No files matched your search

+3 -1
View File
@@ -1127,7 +1127,9 @@ win_T *win_split_ins(int size, int flags, win_T *new_wp, int dir, frame_T *to_fl
return NULL;
}
trigger_winnewpre();
if (new_wp == NULL) {
trigger_winnewpre();
}
win_T *oldwin;
if (flags & WSP_TOP) {
+1 -2
View File
@@ -1043,8 +1043,7 @@ func Test_win_splitmove()
let s:triggered = []
augroup WinSplitMove
au!
" Nvim: WinNewPre not ported yet. Also needs full port of v9.1.0117 to pass.
" au WinNewPre * let s:triggered += ['WinNewPre']
au WinNewPre * let s:triggered += ['WinNewPre']
au WinNew * let s:triggered += ['WinNew', win_getid()]
au WinClosed * let s:triggered += ['WinClosed', str2nr(expand('<afile>'))]
augroup END