From eb44a68b42eda207a5bc4def9ea8fc4d38acb650 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 3 Aug 2017 22:44:55 +0200 Subject: patch 8.0.0858: can exit while a terminal is still running a job Problem: Can exit while a terminal is still running a job. Solution: Consider a buffer with a running job like a changed file. --- src/ex_docmd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/ex_docmd.c') diff --git a/src/ex_docmd.c b/src/ex_docmd.c index f913b19cd..c61cd2e95 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7291,7 +7291,7 @@ ex_quit(exarg_T *eap) */ if (check_more(FALSE, eap->forceit) == OK && only_one_window()) exiting = TRUE; - if ((!P_HID(curbuf) + if ((!buf_hide(curbuf) && check_changed(curbuf, (p_awa ? CCGD_AW : 0) | (eap->forceit ? CCGD_FORCEIT : 0) | CCGD_EXCMD)) @@ -7318,7 +7318,7 @@ ex_quit(exarg_T *eap) need_mouse_correct = TRUE; # endif /* close window; may free buffer */ - win_close(wp, !P_HID(wp->w_buffer) || eap->forceit); + win_close(wp, !buf_hide(wp->w_buffer) || eap->forceit); #endif } } @@ -7438,7 +7438,7 @@ ex_win_close( buf_T *buf = win->w_buffer; need_hide = (bufIsChanged(buf) && buf->b_nwindows <= 1); - if (need_hide && !P_HID(buf) && !forceit) + if (need_hide && !buf_hide(buf) && !forceit) { # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || cmdmod.confirm) && p_write) @@ -7465,9 +7465,9 @@ ex_win_close( /* free buffer when not hiding it or when it's a scratch buffer */ if (tp == NULL) - win_close(win, !need_hide && !P_HID(buf)); + win_close(win, !need_hide && !buf_hide(buf)); else - win_close_othertab(win, !need_hide && !P_HID(buf), tp); + win_close_othertab(win, !need_hide && !buf_hide(buf), tp); } /* @@ -7864,7 +7864,7 @@ ex_exit(exarg_T *eap) need_mouse_correct = TRUE; # endif /* Quit current window, may free the buffer. */ - win_close(curwin, !P_HID(curwin->w_buffer)); + win_close(curwin, !buf_hide(curwin->w_buffer)); #endif } } @@ -7960,7 +7960,7 @@ handle_drop( * We don't need to check if the 'hidden' option is set, as in this * case the buffer won't be lost. */ - if (!P_HID(curbuf) && !split) + if (!buf_hide(curbuf) && !split) { ++emsg_off; split = check_changed(curbuf, CCGD_AW); @@ -8747,7 +8747,7 @@ do_exedit( (*eap->arg == NUL && eap->do_ecmd_lnum == 0 && vim_strchr(p_cpo, CPO_GOTO1) != NULL) ? ECMD_ONE : eap->do_ecmd_lnum, - (P_HID(curbuf) ? ECMD_HIDE : 0) + (buf_hide(curbuf) ? ECMD_HIDE : 0) + (eap->forceit ? ECMD_FORCEIT : 0) /* after a split we can use an existing buffer */ + (old_curwin != NULL ? ECMD_OLDBUF : 0) @@ -8761,7 +8761,7 @@ do_exedit( if (old_curwin != NULL) { need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1); - if (!need_hide || P_HID(curbuf)) + if (!need_hide || buf_hide(curbuf)) { # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) cleanup_T cs; @@ -8773,7 +8773,7 @@ do_exedit( # ifdef FEAT_GUI need_mouse_correct = TRUE; # endif - win_close(curwin, !need_hide && !P_HID(curbuf)); + win_close(curwin, !need_hide && !buf_hide(curbuf)); # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not -- cgit v1.2.1