From: Bram Moolenaar Date: Wed, 22 Sep 2021 12:18:13 +0000 (+0200) Subject: patch 8.2.3453: autocmd not executed when editing a directory X-Git-Tag: v8.2.3453 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=40fa12aea352474d229f2f750e954a4318aead4e;p=vim patch 8.2.3453: autocmd not executed when editing a directory Problem: Autocmd not executed when editing a directory ending in a path separator inside try block. Solution: Return NOTDONE instead of FAIL. (closes #8885) --- diff --git a/src/fileio.c b/src/fileio.c index eb46f1fd8..1767e5e09 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -338,7 +338,7 @@ readfile( filemess(curbuf, fname, (char_u *)_(msg_is_a_directory), 0); msg_end(); msg_scroll = msg_save; - return FAIL; + return NOTDONE; } } diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index b2e4952be..f769eec17 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -2346,6 +2346,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_SafeState() CheckRunVimInTerminal diff --git a/src/version.c b/src/version.c index 8417acd10..b1130882f 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3453, /**/ 3452, /**/