]> granicus.if.org Git - vim/commitdiff
patch 8.2.3626: "au! event" cannot be followed by another command v8.2.3626
authorBram Moolenaar <Bram@vim.org>
Sat, 20 Nov 2021 10:38:25 +0000 (10:38 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 20 Nov 2021 10:38:25 +0000 (10:38 +0000)
Problem:    "au!" and "au! event" cannot be followed by another command as
            documented.
Solution:   When a bar is found set nextcmd.

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

index 14cd4af592c1cb5b3c6a011ebed2981f55cc9da5..ac21196b9a78332072857775182cd6baa27e84e0 100644 (file)
@@ -845,6 +845,7 @@ do_autocmd(exarg_T *eap, char_u *arg_in, int forceit)
 
     if (*arg == '|')
     {
+       eap->nextcmd = arg + 1;
        arg = (char_u *)"";
        group = AUGROUP_ALL;    // no argument, use all groups
     }
@@ -869,6 +870,7 @@ do_autocmd(exarg_T *eap, char_u *arg_in, int forceit)
     pat = skipwhite(pat);
     if (*pat == '|')
     {
+       eap->nextcmd = pat + 1;
        pat = (char_u *)"";
        cmd = (char_u *)"";
     }
index 045320e5f59ee3b64dc0d6835ba7827aff1a2b10..4bdb8dc22e146829587a38ef082abdbb8b2c9602 100644 (file)
@@ -357,17 +357,20 @@ endfunc
 func Test_early_bar()
   " test that a bar is recognized before the {event}
   call s:AddAnAutocmd()
-  augroup vimBarTest | au! | augroup END
+  augroup vimBarTest | au! | let done = 77 | augroup END
   call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
+  call assert_equal(77, done)
 
   call s:AddAnAutocmd()
-  augroup vimBarTest| au!| augroup END
+  augroup vimBarTest| au!| let done = 88 | augroup END
   call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
+  call assert_equal(88, done)
 
   " test that a bar is recognized after the {event}
   call s:AddAnAutocmd()
-  augroup vimBarTest| au!BufReadCmd| augroup END
+  augroup vimBarTest| au!BufReadCmd| let done = 99 | augroup END
   call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
+  call assert_equal(99, done)
 
   " test that a bar is recognized after the {group}
   call s:AddAnAutocmd()
index 8e84cbb4569a42c6c23c4f2c51dfcbf642f36566..c54307e15eab6ac40b10c636a244d63718b36b4d 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3626,
 /**/
     3625,
 /**/