From: zeertzjq Date: Thu, 8 Jan 2026 20:23:05 +0000 (+0000) Subject: patch 9.1.2066: :wqall! doesn't close a terminal like :qall! does X-Git-Tag: v9.1.2066^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8558fdf4f2758163218289637e82c3ae2d617ec;p=thirdparty%2Fvim.git patch 9.1.2066: :wqall! doesn't close a terminal like :qall! does Problem: :wqall! doesn't close a terminal buffer like :qall! does (after 8.0.1525). Solution: Check eap->forceit (zeertzjq). Ref: https://github.com/vim/vim/issues/2654#issuecomment-366803932 related: #2654 related: neovim/neovim#14061 closes: #19129 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- diff --git a/src/buffer.c b/src/buffer.c index 87b87272a8..9bb13da8f3 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -49,7 +49,6 @@ static int append_arg_number(win_T *wp, char_u *buf, size_t buflen, int add_file static void free_buffer(buf_T *); static void free_buffer_stuff(buf_T *buf, int free_options); static int bt_nofileread(buf_T *buf); -static void no_write_message_buf(buf_T *buf); static int do_buffer_ext(int action, int start, int dir, int count, int flags); #ifdef UNIX @@ -2079,8 +2078,8 @@ do_autochdir(void) } #endif - static void -no_write_message_buf(buf_T *buf UNUSED) + void +no_write_message_buf(buf_T *buf) { #ifdef FEAT_TERMINAL if (term_job_running(buf->b_term)) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index e8343cae43..c9b4974c2b 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -2509,9 +2509,9 @@ do_wqall(exarg_T *eap) FOR_ALL_BUFFERS(buf) { #ifdef FEAT_TERMINAL - if (exiting && term_job_running(buf->b_term)) + if (exiting && !eap->forceit && term_job_running(buf->b_term)) { - no_write_message_nobang(buf); + no_write_message_buf(buf); ++error; } else diff --git a/src/proto/buffer.pro b/src/proto/buffer.pro index 9044bae83f..cb4de270d8 100644 --- a/src/proto/buffer.pro +++ b/src/proto/buffer.pro @@ -15,6 +15,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit); char *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit); void set_curbuf(buf_T *buf, int action); void do_autochdir(void); +void no_write_message_buf(buf_T *buf); void no_write_message(void); void no_write_message_nobang(buf_T *buf); int curbuf_reusable(void); diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 0597c36a6f..1097b06c7d 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -1368,7 +1368,7 @@ func Test_terminal_qall_kill_func() endfunc " Run Vim, start a terminal in that Vim without the kill argument, -" check that :qall does not exit, :qall! does. +" check that :qall does not exit. func Test_terminal_qall_exit() let after =<< trim [CODE] term @@ -1390,6 +1390,28 @@ func Test_terminal_qall_exit() call delete("Xdone") endfunc +" :qall! and :wqall! should exit when there is a terminal buffer. +func Test_terminal_qall_wqall_bang_exit() + for cmd in ['qall!', 'wqall!'] + let after =<< trim eval [CODE] + term + let buf = bufnr("%") + while term_getline(buf, 1) =~ "^\\s*$" + sleep 10m + endwhile + set nomore + au VimLeavePre * call writefile(["done"], "Xdone") + {cmd} + [CODE] + + if !RunVim([], after, '') + continue + endif + call assert_equal("done", readfile("Xdone")[0]) + call delete("Xdone") + endfor +endfunc + " Run Vim in a terminal, then start a terminal in that Vim without a kill " argument, check that :confirm qall works. func Test_terminal_qall_prompt() diff --git a/src/version.c b/src/version.c index 45a660d0bb..1f83c825f0 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2066, /**/ 2065, /**/