diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-03-26 08:27:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-26 08:27:29 +0800 |
commit | c2378be3dd5cd7d97f7a22a2472fcee9992b1c31 (patch) | |
tree | 55b4d772ce4228fc8b4460eee833d806fcfb6304 | |
parent | 876d22fca9a102141f3b1bc6776f4bdd855099fb (diff) | |
download | rneovim-c2378be3dd5cd7d97f7a22a2472fcee9992b1c31.tar.gz rneovim-c2378be3dd5cd7d97f7a22a2472fcee9992b1c31.tar.bz2 rneovim-c2378be3dd5cd7d97f7a22a2472fcee9992b1c31.zip |
vim-patch:8.2.3453: autocmd not executed when editing a directory (#17846)
Problem: Autocmd not executed when editing a directory ending in a path
separator inside try block.
Solution: Return NOTDONE instead of FAIL. (closes vim/vim#8885)
https://github.com/vim/vim/commit/40fa12aea352474d229f2f750e954a4318aead4e
-rw-r--r-- | src/nvim/fileio.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_autocmd.vim | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index fe61a2fc90..7905b29876 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -361,7 +361,7 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski filemess(curbuf, fname, (char_u *)_(msg_is_a_directory), 0); msg_end(); msg_scroll = msg_save; - return FAIL; + return NOTDONE; } } diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index c39546b9ea..d4005e41e8 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -2343,6 +2343,19 @@ func Test_throw_in_BufWritePre() au! throwing endfunc +func Test_autocmd_in_try_block() + call mkdir('Xdir') + au BufEnter * let g:fname = expand('%') + try + edit Xdir/ + endtry + call assert_match('Xdir', g:fname) + + unlet g:fname + au! BufEnter + call delete('Xdir', 'rf') +endfunc + func Test_autocmd_CmdWinEnter() CheckRunVimInTerminal " There is not cmdwin switch, so |