terminal: Move re-edit detection to do_ecmd(). #5445

Closes #4784
This commit is contained in:
Harm te Hennepe
2016-10-07 16:19:43 +02:00
committed by Justin M. Keyes
parent cb351c678b
commit 538255c228
3 changed files with 11 additions and 5 deletions

View File

@@ -2116,6 +2116,16 @@ do_ecmd (
} }
} }
// Make re-editing a terminal buffer a no-op
if (!other_file && curbuf->terminal != NULL) {
// this is needed for when we are called by do_argfile() and the new
// argument index becomes the terminal buffer we are already editing
check_arg_idx(curwin);
maketitle();
retval = OK;
goto theend;
}
/* /*
* if the file was changed we may not be allowed to abandon it * if the file was changed we may not be allowed to abandon it
* - if we are going to re-edit the same file * - if we are going to re-edit the same file

View File

@@ -6726,11 +6726,6 @@ do_exedit (
old_curwin == NULL ? curwin : NULL); old_curwin == NULL ? curwin : NULL);
} else if ((eap->cmdidx != CMD_split && eap->cmdidx != CMD_vsplit) } else if ((eap->cmdidx != CMD_split && eap->cmdidx != CMD_vsplit)
|| *eap->arg != NUL) { || *eap->arg != NUL) {
// ":edit <blank>" is a no-op in terminal buffers. #2822
if (curbuf->terminal != NULL && eap->cmdidx == CMD_edit && *eap->arg == NUL) {
return;
}
/* Can't edit another file when "curbuf_lock" is set. Only ":edit" /* Can't edit another file when "curbuf_lock" is set. Only ":edit"
* can bring us here, others are stopped earlier. */ * can bring us here, others are stopped earlier. */
if (*eap->arg != NUL && curbuf_locked()) if (*eap->arg != NUL && curbuf_locked())

View File

@@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen')
local clear, wait, nvim = helpers.clear, helpers.wait, helpers.nvim local clear, wait, nvim = helpers.clear, helpers.wait, helpers.nvim
local nvim_dir, source, eq = helpers.nvim_dir, helpers.source, helpers.eq local nvim_dir, source, eq = helpers.nvim_dir, helpers.source, helpers.eq
local execute, eval = helpers.execute, helpers.eval local execute, eval = helpers.execute, helpers.eval
local funcs = helpers.funcs
if helpers.pending_win32(pending) then return end if helpers.pending_win32(pending) then return end