]> granicus.if.org Git - vim/commitdiff
patch 8.2.3453: autocmd not executed when editing a directory v8.2.3453
authorBram Moolenaar <Bram@vim.org>
Wed, 22 Sep 2021 12:18:13 +0000 (14:18 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 22 Sep 2021 12:18:13 +0000 (14:18 +0200)
Problem:    Autocmd not executed when editing a directory ending in a path
            separator inside try block.
Solution:   Return NOTDONE instead of FAIL. (closes #8885)

src/fileio.c
src/testdir/test_autocmd.vim
src/version.c

index eb46f1fd86c0298622da7eaf5576cc574d4f1b66..1767e5e0912bb776789ea2738bbcce985e13c829 100644 (file)
@@ -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;
        }
     }
 
index b2e4952be089ea34c1baacd1b0b721a226741bf3..f769eec17fe2f01424fe2103cc81ad9b655df873 100644 (file)
@@ -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
 
index 8417acd109640af6a42bb9e97a0bd17d7a1aa94f..b1130882f84a70d7f9670af7acb987d6d8403699 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3453,
 /**/
     3452,
 /**/