diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-03-10 20:28:12 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-03-10 20:28:12 +0100 |
commit | 25cdd9c33b21ddbd31321c075873bb225450d2d2 (patch) | |
tree | 380538cdf0abb9b7f3777c57ada6930930c9e036 /src/ex_cmds2.c | |
parent | b5b7562475ad032a174b893286172de0d2c157cd (diff) | |
download | vim-git-25cdd9c33b21ddbd31321c075873bb225450d2d2.tar.gz |
patch 8.0.1593: :qall never exits with an active terminal windowv8.0.1593
Problem: :qall never exits with an active terminal window.
Solution: Add a way to kill a job in a terminal window.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r-- | src/ex_cmds2.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 424bac8c7..ae4ce337d 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -2254,7 +2254,7 @@ add_bufnum(int *bufnrs, int *bufnump, int nr) /* * Return TRUE if any buffer was changed and cannot be abandoned. * That changed buffer becomes the current buffer. - * When "unload" is true the current buffer is unloaded instead of making it + * When "unload" is TRUE the current buffer is unloaded instead of making it * hidden. This is used for ":q!". */ int @@ -2272,6 +2272,7 @@ check_changed_any( tabpage_T *tp; win_T *wp; + /* Make a list of all buffers, with the most important ones first. */ FOR_ALL_BUFFERS(buf) ++bufcount; @@ -2284,17 +2285,19 @@ check_changed_any( /* curbuf */ bufnrs[bufnum++] = curbuf->b_fnum; - /* buf in curtab */ + + /* buffers in current tab */ FOR_ALL_WINDOWS(wp) if (wp->w_buffer != curbuf) add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); - /* buf in other tab */ + /* buffers in other tabs */ FOR_ALL_TABPAGES(tp) if (tp != curtab) for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); - /* any other buf */ + + /* any other buffer */ FOR_ALL_BUFFERS(buf) add_bufnum(bufnrs, &bufnum, buf->b_fnum); @@ -2308,6 +2311,14 @@ check_changed_any( bufref_T bufref; set_bufref(&bufref, buf); +#ifdef FEAT_TERMINAL + if (term_job_running(buf->b_term)) + { + if (term_try_stop_job(buf) == FAIL) + break; + } + else +#endif /* Try auto-writing the buffer. If this fails but the buffer no * longer exists it's not changed, that's OK. */ if (check_changed(buf, (p_awa ? CCGD_AW : 0) @@ -2320,6 +2331,7 @@ check_changed_any( if (i >= bufnum) goto theend; + /* Get here if "buf" cannot be abandoned. */ ret = TRUE; exiting = FALSE; #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) |