summaryrefslogtreecommitdiffstats
path: root/src/terminal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-28 18:51:43 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-28 18:51:43 +0000
commite76062c078debed0df818f70e4db14ad7a7cb53a (patch)
treee43b3b076fdea909c460219e896237a8924ccb6b /src/terminal.c
parent74a694dbe20bb7dea4e06f474cf62e20f9c92f1d (diff)
patch 9.0.0965: using one window for executing autocommands is insufficientv9.0.0965
Problem: Using one window for executing autocommands is insufficient. Solution: Use up to five windows for executing autocommands.
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/terminal.c b/src/terminal.c
index d300c59a24..18f9c62602 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3560,15 +3560,18 @@ term_after_channel_closed(term_T *term)
// ++close or term_finish == "close"
ch_log(NULL, "terminal job finished, closing window");
aucmd_prepbuf(&aco, term->tl_buffer);
- // Avoid closing the window if we temporarily use it.
- if (curwin == aucmd_win)
- do_set_w_closing = TRUE;
- if (do_set_w_closing)
- curwin->w_closing = TRUE;
- do_bufdel(DOBUF_WIPE, (char_u *)"", 1, fnum, fnum, FALSE);
- if (do_set_w_closing)
- curwin->w_closing = FALSE;
- aucmd_restbuf(&aco);
+ if (curbuf == term->tl_buffer)
+ {
+ // Avoid closing the window if we temporarily use it.
+ if (is_aucmd_win(curwin))
+ do_set_w_closing = TRUE;
+ if (do_set_w_closing)
+ curwin->w_closing = TRUE;
+ do_bufdel(DOBUF_WIPE, (char_u *)"", 1, fnum, fnum, FALSE);
+ if (do_set_w_closing)
+ curwin->w_closing = FALSE;
+ aucmd_restbuf(&aco);
+ }
#ifdef FEAT_PROP_POPUP
if (pwin != NULL)
popup_close_with_retval(pwin, 0);