summaryrefslogtreecommitdiff
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-03 22:44:55 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-03 22:44:55 +0200
commiteb44a68b42eda207a5bc4def9ea8fc4d38acb650 (patch)
tree6fae22aba3c4f1eaad8e6d5e4d74df201c78a65e /src/ex_cmds2.c
parent620d064b0b0bca2268574abdec2d8eac3384cfdf (diff)
downloadvim-git-eb44a68b42eda207a5bc4def9ea8fc4d38acb650.tar.gz
patch 8.0.0858: can exit while a terminal is still running a jobv8.0.0858
Problem: Can exit while a terminal is still running a job. Solution: Consider a buffer with a running job like a changed file.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 381c5d1c2..26b588c65 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2064,7 +2064,7 @@ dialog_changed(
int
can_abandon(buf_T *buf, int forceit)
{
- return ( P_HID(buf)
+ return ( buf_hide(buf)
|| !bufIsChanged(buf)
|| buf->b_nwindows > 1
|| autowrite(buf, forceit) == OK
@@ -2180,7 +2180,14 @@ check_changed_any(
msg_col = 0;
msg_didout = FALSE;
}
- if (EMSG2(_("E162: No write since last change for buffer \"%s\""),
+ if (
+#ifdef FEAT_TERMINAL
+ term_job_running(buf->b_term)
+ ? EMSG2(_("E947: Job still running in buffer \"%s\""),
+ buf->b_fname)
+ :
+#endif
+ EMSG2(_("E162: No write since last change for buffer \"%s\""),
buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname))
{
save = no_wait_return;
@@ -2734,13 +2741,13 @@ do_argfile(exarg_T *eap, int argn)
* the same buffer
*/
other = TRUE;
- if (P_HID(curbuf))
+ if (buf_hide(curbuf))
{
p = fix_fname(alist_name(&ARGLIST[argn]));
other = otherfile(p);
vim_free(p);
}
- if ((!P_HID(curbuf) || !other)
+ if ((!buf_hide(curbuf) || !other)
&& check_changed(curbuf, CCGD_AW
| (other ? 0 : CCGD_MULTWIN)
| (eap->forceit ? CCGD_FORCEIT : 0)
@@ -2761,7 +2768,7 @@ do_argfile(exarg_T *eap, int argn)
* argument index. */
if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
eap, ECMD_LAST,
- (P_HID(curwin->w_buffer) ? ECMD_HIDE : 0)
+ (buf_hide(curwin->w_buffer) ? ECMD_HIDE : 0)
+ (eap->forceit ? ECMD_FORCEIT : 0), curwin) == FAIL)
curwin->w_arg_idx = old_arg_idx;
/* like Vi: set the mark where the cursor is in the file. */
@@ -2782,7 +2789,7 @@ ex_next(exarg_T *eap)
* check for changed buffer now, if this fails the argument list is not
* redefined.
*/
- if ( P_HID(curbuf)
+ if ( buf_hide(curbuf)
|| eap->cmdidx == CMD_snext
|| !check_changed(curbuf, CCGD_AW
| (eap->forceit ? CCGD_FORCEIT : 0)
@@ -2937,7 +2944,7 @@ ex_listdo(exarg_T *eap)
if (eap->cmdidx == CMD_windo
|| eap->cmdidx == CMD_tabdo
- || P_HID(curbuf)
+ || buf_hide(curbuf)
|| !check_changed(curbuf, CCGD_AW
| (eap->forceit ? CCGD_FORCEIT : 0)
| CCGD_EXCMD))