mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 20:08:17 +00:00
open_buffer(): Do BufEnter
for directories.
Abuse NOTDONE to give some nuance to the return value of readfile(), so that open_buffer() can distinguish between "failed, lol" and "failed because the path is a directory". Before this change, Vim *already* creates a new buffer when a directory is edited. So there is no reason it should not raise BufEnter, that was an implementation detail of ye olde readfile(). Most of the changes in this commit merely preserve the old semantics. The "implicit" change that we actually are interested in, is this line in `open_buffer()`, where `retval` being non-FAIL allows EVENT_BUFENTER to be applied: apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval); References https://github.com/vim/vim/issues/1353
This commit is contained in:
@@ -193,10 +193,13 @@ open_buffer (
|
||||
* it can be changed there. */
|
||||
if (!readonlymode && !bufempty())
|
||||
changed();
|
||||
else if (retval != FAIL)
|
||||
else if (retval == OK) {
|
||||
unchanged(curbuf, FALSE);
|
||||
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
|
||||
curbuf, &retval);
|
||||
}
|
||||
if (retval == OK) {
|
||||
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
|
||||
curbuf, &retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +222,7 @@ open_buffer (
|
||||
|| (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
|
||||
)
|
||||
changed();
|
||||
else if (retval != FAIL && !read_stdin)
|
||||
else if (retval == OK && !read_stdin)
|
||||
unchanged(curbuf, FALSE);
|
||||
save_file_ff(curbuf); /* keep this fileformat */
|
||||
|
||||
|
Reference in New Issue
Block a user