ex_docmd: '/' is not a path for Cmdline* events

Code from https://github.com/neovim/neovim/pull/9348#issuecomment-446416118

autocmd_fname_full was removed in 82cd0be2ea
but Vim uses this hack for <afile> on CmdlineEnter and related events
in vim-patch:8.0.1748.
Port the hack by not treating "/" as a path for <afile> on these events.
This commit is contained in:
Jan Edmund Lazo 2018-12-11 20:46:13 -05:00
parent 0930435fc3
commit 4157f4c72d

View File

@ -8654,7 +8654,10 @@ eval_vars (
break;
case SPEC_AFILE: // file name for autocommand
if (autocmd_fname != NULL && !path_is_absolute(autocmd_fname)) {
if (autocmd_fname != NULL
&& !path_is_absolute(autocmd_fname)
// For CmdlineEnter and related events, <afile> is not a path! #9348
&& !strequal("/", (char *)autocmd_fname)) {
// Still need to turn the fname into a full path. It was
// postponed to avoid a delay when <afile> is not used.
result = (char_u *)FullName_save((char *)autocmd_fname, false);