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>
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
}
#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))
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
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);
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
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()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2066,
/**/
2065,
/**/