Merge pull request #20990 from zeertzjq/vim-8.2.2060

vim-patch:8.2.{2060,3626}
This commit is contained in:
zeertzjq
2022-11-07 20:13:39 +08:00
committed by GitHub
7 changed files with 23 additions and 26 deletions

View File

@@ -779,7 +779,7 @@ void au_event_restore(char *old_ei)
// :autocmd * *.c show all autocommands for *.c files. // :autocmd * *.c show all autocommands for *.c files.
// //
// Mostly a {group} argument can optionally appear before <event>. // Mostly a {group} argument can optionally appear before <event>.
void do_autocmd(char *arg_in, int forceit) void do_autocmd(exarg_T *eap, char *arg_in, int forceit)
{ {
char *arg = arg_in; char *arg = arg_in;
char *envpat = NULL; char *envpat = NULL;
@@ -790,6 +790,7 @@ void do_autocmd(char *arg_in, int forceit)
int group; int group;
if (*arg == '|') { if (*arg == '|') {
eap->nextcmd = arg + 1;
arg = ""; arg = "";
group = AUGROUP_ALL; // no argument, use all groups group = AUGROUP_ALL; // no argument, use all groups
} else { } else {
@@ -806,6 +807,7 @@ void do_autocmd(char *arg_in, int forceit)
pat = skipwhite(pat); pat = skipwhite(pat);
if (*pat == '|') { if (*pat == '|') {
eap->nextcmd = pat + 1;
pat = ""; pat = "";
cmd = ""; cmd = "";
} else { } else {

View File

@@ -4231,7 +4231,7 @@ static void ex_autocmd(exarg_T *eap)
secure = 2; secure = 2;
eap->errmsg = _(e_curdir); eap->errmsg = _(e_curdir);
} else if (eap->cmdidx == CMD_autocmd) { } else if (eap->cmdidx == CMD_autocmd) {
do_autocmd(eap->arg, eap->forceit); do_autocmd(eap, eap->arg, eap->forceit);
} else { } else {
do_augroup(eap->arg, eap->forceit); do_augroup(eap->arg, eap->forceit);
} }

View File

@@ -481,17 +481,20 @@ endfunc
func Test_early_bar() func Test_early_bar()
" test that a bar is recognized before the {event} " test that a bar is recognized before the {event}
call s:AddAnAutocmd() 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(1, len(split(execute('au vimBarTest'), "\n")))
call assert_equal(77, done)
call s:AddAnAutocmd() 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(1, len(split(execute('au vimBarTest'), "\n")))
call assert_equal(88, done)
" test that a bar is recognized after the {event} " test that a bar is recognized after the {event}
call s:AddAnAutocmd() 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(1, len(split(execute('au vimBarTest'), "\n")))
call assert_equal(99, done)
" test that a bar is recognized after the {group} " test that a bar is recognized after the {group}
call s:AddAnAutocmd() call s:AddAnAutocmd()
@@ -1975,9 +1978,7 @@ func Test_change_mark_in_autocmds()
endfunc endfunc
func Test_Filter_noshelltemp() func Test_Filter_noshelltemp()
if !executable('cat') CheckExecutable cat
return
endif
enew! enew!
call setline(1, ['a', 'b', 'c', 'd']) call setline(1, ['a', 'b', 'c', 'd'])

View File

@@ -1,9 +1,11 @@
" Test the :compiler command " Test the :compiler command
source check.vim
source shared.vim
func Test_compiler() func Test_compiler()
if !executable('perl') CheckExecutable perl
return CheckFeature quickfix
endif
" $LANG changes the output of Perl. " $LANG changes the output of Perl.
if $LANG != '' if $LANG != ''

View File

@@ -1,5 +1,7 @@
" Test for delete(). " Test for delete().
source check.vim
func Test_file_delete() func Test_file_delete()
split Xfile split Xfile
call setline(1, ['a', 'b']) call setline(1, ['a', 'b'])
@@ -41,9 +43,7 @@ func Test_recursive_delete()
endfunc endfunc
func Test_symlink_delete() func Test_symlink_delete()
if !has('unix') CheckUnix
return
endif
split Xfile split Xfile
call setline(1, ['a', 'b']) call setline(1, ['a', 'b'])
wq wq
@@ -56,9 +56,7 @@ func Test_symlink_delete()
endfunc endfunc
func Test_symlink_dir_delete() func Test_symlink_dir_delete()
if !has('unix') CheckUnix
return
endif
call mkdir('Xdir1') call mkdir('Xdir1')
silent !ln -s Xdir1 Xlink silent !ln -s Xdir1 Xlink
call assert_true(isdirectory('Xdir1')) call assert_true(isdirectory('Xdir1'))
@@ -70,9 +68,7 @@ func Test_symlink_dir_delete()
endfunc endfunc
func Test_symlink_recursive_delete() func Test_symlink_recursive_delete()
if !has('unix') CheckUnix
return
endif
call mkdir('Xdir3') call mkdir('Xdir3')
call mkdir('Xdir3/subdir') call mkdir('Xdir3/subdir')
call mkdir('Xdir4') call mkdir('Xdir4')

View File

@@ -621,9 +621,7 @@ func Test_diff_move_to()
endfunc endfunc
func Test_diffexpr() func Test_diffexpr()
if !executable('diff') CheckExecutable diff
return
endif
func DiffExpr() func DiffExpr()
" Prepend some text to check diff type detection " Prepend some text to check diff type detection

View File

@@ -95,9 +95,7 @@ func Test_indent_fold2()
endfunc endfunc
func Test_manual_fold_with_filter() func Test_manual_fold_with_filter()
if !executable('cat') CheckExecutable cat
return
endif
for type in ['manual', 'marker'] for type in ['manual', 'marker']
exe 'set foldmethod=' . type exe 'set foldmethod=' . type
new new