]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.2066: :wqall! doesn't close a terminal like :qall! does v9.1.2066
authorzeertzjq <zeertzjq@outlook.com>
Thu, 8 Jan 2026 20:23:05 +0000 (20:23 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 8 Jan 2026 20:23:05 +0000 (20:23 +0000)
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 <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/buffer.c
src/ex_cmds.c
src/proto/buffer.pro
src/testdir/test_terminal.vim
src/version.c

index 87b87272a801bd3aaba0369434d6a1865a15bb2f..9bb13da8f3faffcb4e0f03f4765cf25e0a18154c 100644 (file)
@@ -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))
index e8343cae43d1acee80a6df2a6036b4ed1cbb965b..c9b4974c2b0c08714a25acefc2f47dec82eafa41 100644 (file)
@@ -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
index 9044bae83f9d3a339aaf7e4c448b60317fb0791e..cb4de270d8365ff5d3bfaadf0ad7ad67fe671a09 100644 (file)
@@ -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);
index 0597c36a6f5057e18c0313cc99854eea1f1304c3..1097b06c7d728b104303ff12840144a2c41fdc17 100644 (file)
@@ -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()
index 45a660d0bb5d902f3563759de2ea2631e92b2fbb..1f83c825f08566ac76cd04e87a9902a00fa7a39d 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2066,
 /**/
     2065,
 /**/