]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0593: :wqall ignores term_setkill() on running terminal buffers v9.2.0593
authorFoxe Chen <chen.foxe@gmail.com>
Wed, 3 Jun 2026 19:18:04 +0000 (19:18 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 3 Jun 2026 19:18:04 +0000 (19:18 +0000)
Problem:  :wqall ignores term_setkill() on running terminal buffers
Solution: In do_wqall(), call term_try_stop_job() on the running
          terminal buffer first (Foxe Chen).

closes: #20417

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/ex_cmds.c
src/testdir/test_terminal.vim
src/version.c

index 7999cba0e0897b2e33a9c3497d4123d145181c46..cedb9edf882cdac60de6cb5c11b6f2d09113473a 100644 (file)
@@ -2515,8 +2515,11 @@ do_wqall(exarg_T *eap)
 #ifdef FEAT_TERMINAL
        if (exiting && !eap->forceit && term_job_running(buf->b_term))
        {
-           no_write_message_buf(buf);
-           ++error;
+           if (term_try_stop_job(buf) == FAIL)
+           {
+               no_write_message_buf(buf);
+               ++error;
+           }
        }
        else
 #endif
index c6521d3efe0f725375f428a6f03e905dde72d428..2c6dca1e39e7d634d43cefae4f524459f902dc41 100644 (file)
@@ -1334,7 +1334,7 @@ endfunc
 
 " Run Vim, start a terminal in that Vim with the kill argument,
 " :qall works.
-func Run_terminal_qall_kill(line1, line2)
+func Run_terminal_qall_kill_int(line1, line2, cmd)
   " 1. Open a terminal window and wait for the prompt to appear
   " 2. set kill using term_setkill()
   " 3. make Vim exit, it will kill the shell
@@ -1346,7 +1346,7 @@ func Run_terminal_qall_kill(line1, line2)
        \ 'endwhile',
        \ a:line2,
        \ 'au VimLeavePre * call writefile(["done"], "Xdone")',
-       \ 'qall',
+       \ a:cmd,
        \ ]
   if !RunVim([], after, '')
     return
@@ -1355,6 +1355,11 @@ func Run_terminal_qall_kill(line1, line2)
   call delete("Xdone")
 endfunc
 
+func Run_terminal_qall_kill(line1, line2)
+  call Run_terminal_qall_kill_int(a:line1, a:line2, 'qall')
+  call Run_terminal_qall_kill_int(a:line1, a:line2, 'wqall')
+endfunc
+
 " Run Vim in a terminal, then start a terminal in that Vim with a kill
 " argument, check that :qall works.
 func Test_terminal_qall_kill_arg()
index 250b6381539c64461451bdb1cab28ffc24abd5ab..cacb63cb8c30bf6c5913446934065d6fb6369a90 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    593,
 /**/
     592,
 /**/