diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-01-12 02:33:15 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-01-12 23:10:38 +0100 |
commit | 42c922b32c0a22fbe078d03bac5de0cfa7bd0b9f (patch) | |
tree | 234c832182161724f9117e5e130279b4287ca915 /src/nvim/ex_docmd.c | |
parent | 50d0d891299c111c5e349c084ef146facfaad009 (diff) | |
download | rneovim-42c922b32c0a22fbe078d03bac5de0cfa7bd0b9f.tar.gz rneovim-42c922b32c0a22fbe078d03bac5de0cfa7bd0b9f.tar.bz2 rneovim-42c922b32c0a22fbe078d03bac5de0cfa7bd0b9f.zip |
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
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 19691ccc3a..5ff79bcfef 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -6910,9 +6910,10 @@ static void ex_read(exarg_T *eap) eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); } - if (i == FAIL) { - if (!aborting()) + if (i != OK) { + if (!aborting()) { EMSG2(_(e_notopen), eap->arg); + } } else { if (empty && exmode_active) { /* Delete the empty line that remains. Historically ex does |