Patch 8.2.3626

4 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 20, 2021, 5:39:23 AM11/20/21
to vim...@googlegroups.com

Patch 8.2.3626
Problem: "au!" and "au! event" cannot be followed by another command as
documented.
Solution: When a bar is found set nextcmd.
Files: src/autocmd.c, src/testdir/test_autocmd.vim


*** ../vim-8.2.3625/src/autocmd.c 2021-11-13 12:38:45.538835898 +0000
--- src/autocmd.c 2021-11-20 10:35:12.736938862 +0000
***************
*** 845,850 ****
--- 845,851 ----

if (*arg == '|')
{
+ eap->nextcmd = arg + 1;
arg = (char_u *)"";
group = AUGROUP_ALL; // no argument, use all groups
}
***************
*** 869,874 ****
--- 870,876 ----
pat = skipwhite(pat);
if (*pat == '|')
{
+ eap->nextcmd = pat + 1;
pat = (char_u *)"";
cmd = (char_u *)"";
}
*** ../vim-8.2.3625/src/testdir/test_autocmd.vim 2021-11-17 14:01:10.470090290 +0000
--- src/testdir/test_autocmd.vim 2021-11-20 10:34:31.720894203 +0000
***************
*** 357,373 ****
func Test_early_bar()
" test that a bar is recognized before the {event}
call s:AddAnAutocmd()
! augroup vimBarTest | au! | augroup END
call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))

call s:AddAnAutocmd()
! augroup vimBarTest| au!| augroup END
call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))

" test that a bar is recognized after the {event}
call s:AddAnAutocmd()
! augroup vimBarTest| au!BufReadCmd| augroup END
call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))

" test that a bar is recognized after the {group}
call s:AddAnAutocmd()
--- 357,376 ----
func Test_early_bar()
" test that a bar is recognized before the {event}
call s:AddAnAutocmd()
! 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!| 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| 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()
*** ../vim-8.2.3625/src/version.c 2021-11-19 19:41:10.107995978 +0000
--- src/version.c 2021-11-20 10:27:13.491401949 +0000
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3626,
/**/

--
Q: How do you tell the difference between a female cat and a male cat?
A: You ask it a question and if HE answers, it's a male but, if SHE
answers, it's a female.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages