mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(terminal): close without ! if the job is stopped
- If the terminal job is still running then ! is still required. Closes #4683
This commit is contained in:
parent
9695691ee4
commit
55defa1a41
@ -1218,8 +1218,8 @@ do_buffer(
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!forceit && (buf->terminal || bufIsChanged(buf))) {
|
if (!forceit && bufIsChanged(buf)) {
|
||||||
if ((p_confirm || cmdmod.confirm) && p_write && !buf->terminal) {
|
if ((p_confirm || cmdmod.confirm) && p_write) {
|
||||||
dialog_changed(buf, false);
|
dialog_changed(buf, false);
|
||||||
if (!bufref_valid(&bufref)) {
|
if (!bufref_valid(&bufref)) {
|
||||||
// Autocommand deleted buffer, oops! It's not changed now.
|
// Autocommand deleted buffer, oops! It's not changed now.
|
||||||
@ -1231,22 +1231,22 @@ do_buffer(
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (buf->terminal) {
|
EMSGN(_("E89: No write since last change for buffer %" PRId64
|
||||||
if (p_confirm || cmdmod.confirm) {
|
" (add ! to override)"),
|
||||||
if (!dialog_close_terminal(buf)) {
|
buf->b_fnum);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
EMSG2(_("E89: %s will be killed (add ! to override)"),
|
|
||||||
(char *)buf->b_fname);
|
if (!forceit && buf->terminal && terminal_running(buf->terminal)) {
|
||||||
return FAIL;
|
if (p_confirm || cmdmod.confirm) {
|
||||||
}
|
if (!dialog_close_terminal(buf)) {
|
||||||
} else {
|
|
||||||
EMSGN(_("E89: No write since last change for buffer %" PRId64
|
|
||||||
" (add ! to override)"),
|
|
||||||
buf->b_fnum);
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
EMSG2(_("E89: %s will be killed (add ! to override)"),
|
||||||
|
(char *)buf->b_fname);
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,12 @@ local eq, neq = helpers.eq, helpers.neq
|
|||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
local command= helpers.command
|
local command= helpers.command
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
|
local retry = helpers.retry
|
||||||
|
local funcs = helpers.funcs
|
||||||
|
local pesc = helpers.pesc
|
||||||
|
local matches = helpers.matches
|
||||||
|
local nvim_dir = helpers.nvim_dir
|
||||||
|
local iswin = helpers.iswin
|
||||||
|
|
||||||
describe(':terminal buffer', function()
|
describe(':terminal buffer', function()
|
||||||
local screen
|
local screen
|
||||||
@ -255,8 +261,14 @@ describe(':terminal buffer', function()
|
|||||||
command('bdelete!')
|
command('bdelete!')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles wqall', function()
|
it("requires bang (!) to close a running job", function()
|
||||||
|
local cwd = funcs.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '')
|
||||||
|
local ext_pat = iswin() and '%.EXE' or ''
|
||||||
eq('Vim(wqall):E948: Job still running', exc_exec('wqall'))
|
eq('Vim(wqall):E948: Job still running', exc_exec('wqall'))
|
||||||
|
matches('^Vim%(bdelete%):E89: term://'..pesc(cwd)..'//%d+:'..nvim_dir..'/tty%-test'..ext_pat..' will be killed %(add %! to override%)$', exc_exec('bdelete'))
|
||||||
|
command('call jobstop(&channel)')
|
||||||
|
retry(nil, nil, function() assert(0 >= eval('jobwait([&channel], 1000)[0]')) end)
|
||||||
|
command('bdelete')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('does not segfault when pasting empty buffer #13955', function()
|
it('does not segfault when pasting empty buffer #13955', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user