patch 9.1.2066: :wqall! doesn't close a terminal like :qall! does

Commit: 
https://github.com/vim/vim/commit/d8558fdf4f2758163218289637e82c3ae2d617ec
Author: zeertzjq <[email protected]>
Date:   Thu Jan 8 20:23:05 2026 +0000

    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/buffer.c b/src/buffer.c
index 87b87272a..9bb13da8f 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 e8343cae4..c9b4974c2 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 9044bae83..cb4de270d 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 0597c36a6..1097b06c7 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 45a660d0b..1f83c825f 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,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vdwdz-003BJG-0n%40256bit.org.

Raspunde prin e-mail lui