diff options
-rw-r--r-- | src/nvim/buffer.c | 7 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 7 | ||||
-rw-r--r-- | src/nvim/ex_cmds2.c | 2 | ||||
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 5 |
4 files changed, 16 insertions, 5 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index a46784fdb6..839d61cd2e 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1645,10 +1645,11 @@ void no_write_message(void) } } -void no_write_message_nobang(void) +void no_write_message_nobang(const buf_T *const buf) + FUNC_ATTR_NONNULL_ALL { - if (curbuf->terminal - && channel_job_running((uint64_t)curbuf->b_p_channel)) { + if (buf->terminal + && channel_job_running((uint64_t)buf->b_p_channel)) { EMSG(_("E948: Job still running")); } else { EMSG(_("E37: No write since last change")); diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index d2ccbe3e6d..b0a51eaefd 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1965,7 +1965,12 @@ void do_wqall(exarg_T *eap) } FOR_ALL_BUFFERS(buf) { - if (!bufIsChanged(buf) || bt_dontwrite(buf)) { + if (exiting + && buf->terminal + && channel_job_running((uint64_t)buf->b_p_channel)) { + no_write_message_nobang(buf); + error++; + } else if (!bufIsChanged(buf) || bt_dontwrite(buf)) { continue; } /* diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index dfbbe2e1ac..3b9c44c3cd 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1297,7 +1297,7 @@ bool check_changed(buf_T *buf, int flags) if (flags & CCGD_EXCMD) { no_write_message(); } else { - no_write_message_nobang(); + no_write_message_nobang(curbuf); } return true; } diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 8e171d31aa..209537831f 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -6,6 +6,7 @@ local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.s local eq, neq = helpers.eq, helpers.neq local write_file = helpers.write_file local command= helpers.command +local exc_exec = helpers.exc_exec describe(':terminal buffer', function() local screen @@ -253,6 +254,10 @@ describe(':terminal buffer', function() ]]) command('bdelete!') end) + + it('handles wqall', function() + eq('Vim(wqall):E948: Job still running', exc_exec('wqall')) + end) end) describe('No heap-buffer-overflow when using', function() |