From 0930435fc30d1e7e6be05ed1cd1d072e3616b6f4 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 10 Dec 2018 22:41:37 -0500 Subject: vim-patch:8.0.1748: CmdlineEnter command uses backslash instead of slash Problem: CmdlineEnter command uses backslash instead of slash. Solution: Don't treat the character as a file name. (closes vim/vim#2837) https://github.com/vim/vim/commit/a4baf5b32519855bb176a7aa0e9397c137ca890a --- src/nvim/fileio.c | 8 +++++++- src/nvim/testdir/test_autocmd.vim | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 8e5455bc67..fe12a69801 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -6903,7 +6903,13 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, } else { sfname = vim_strsave(fname); // Don't try expanding the following events. - if (event == EVENT_COLORSCHEME + if (event == EVENT_CMDLINECHANGED + || event == EVENT_CMDLINEENTER + || event == EVENT_CMDLINELEAVE + || event == EVENT_CMDWINENTER + || event == EVENT_CMDWINLEAVE + || event == EVENT_CMDUNDEFINED + || event == EVENT_COLORSCHEME || event == EVENT_COLORSCHEMEPRE || event == EVENT_DIRCHANGED || event == EVENT_FILETYPE diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 5deb789f48..253d6750ed 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -840,6 +840,8 @@ func Test_Cmdline() au! CmdlineEnter au! CmdlineLeave + let save_shellslash = &shellslash + set noshellslash au! CmdlineEnter / let g:entered = expand('') au! CmdlineLeave / let g:left = expand('') let g:entered = 0 @@ -852,6 +854,7 @@ func Test_Cmdline() bwipe! au! CmdlineEnter au! CmdlineLeave + let &shellslash = save_shellslash endfunc " Test for BufWritePre autocommand that deletes or unloads the buffer. -- cgit From 4157f4c72db7eab71b9670d517a8cbd3ed8909ba Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 11 Dec 2018 20:46:13 -0500 Subject: 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 https://github.com/neovim/neovim/commit/82cd0be2eaf71c0476e15c66ba3e83c76896d407 but Vim uses this hack for on CmdlineEnter and related events in vim-patch:8.0.1748. Port the hack by not treating "/" as a path for on these events. --- src/nvim/ex_docmd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 6361267d9b..4ef332186e 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -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, 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 is not used. result = (char_u *)FullName_save((char *)autocmd_fname, false); -- cgit