mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 07:28:34 +00:00
vim-patch:8.2.2420: too many problems with using all autocommand events
Problem: Too many problems with using all autocommand events. Solution: Disallow defining an autocommand for all events.9a046fd08b
Delete Test_wipe_cbuffer(). Commitdc5f4a3cc2
should have removed it.
This commit is contained in:
@@ -700,11 +700,15 @@ void do_autocmd(char_u *arg_in, int forceit)
|
|||||||
last_event = (event_T)-1; // for listing the event name
|
last_event = (event_T)-1; // for listing the event name
|
||||||
last_group = AUGROUP_ERROR; // for listing the group name
|
last_group = AUGROUP_ERROR; // for listing the group name
|
||||||
if (*arg == '*' || *arg == NUL || *arg == '|') {
|
if (*arg == '*' || *arg == NUL || *arg == '|') {
|
||||||
for (event_T event = (event_T)0; event < (int)NUM_EVENTS;
|
if (!forceit && *cmd != NUL) {
|
||||||
event = (event_T)(event + 1)) {
|
EMSG(_(e_cannot_define_autocommands_for_all_events));
|
||||||
if (do_autocmd_event(event, pat, once, nested, cmd, forceit, group)
|
} else {
|
||||||
== FAIL) {
|
for (event_T event = (event_T)0; event < (int)NUM_EVENTS;
|
||||||
break;
|
event = (event_T)(event + 1)) {
|
||||||
|
if (do_autocmd_event(event, pat, once, nested, cmd, forceit, group)
|
||||||
|
== FAIL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1009,6 +1009,8 @@ EXTERN char_u e_floatonly[] INIT(=N_(
|
|||||||
EXTERN char_u e_floatexchange[] INIT(=N_(
|
EXTERN char_u e_floatexchange[] INIT(=N_(
|
||||||
"E5602: Cannot exchange or rotate float"));
|
"E5602: Cannot exchange or rotate float"));
|
||||||
|
|
||||||
|
EXTERN char e_cannot_define_autocommands_for_all_events[] INIT(= N_(
|
||||||
|
"E1155: Cannot define autocommands for ALL events"));
|
||||||
|
|
||||||
EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
|
EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
|
||||||
EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
|
EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
|
||||||
|
@@ -1279,26 +1279,9 @@ func Test_TextYankPost()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_nocatch_wipe_all_buffers()
|
func Test_autocommand_all_events()
|
||||||
" Real nasty autocommand: wipe all buffers on any event.
|
call assert_fails('au * * bwipe', 'E1155:')
|
||||||
au * * bwipe *
|
call assert_fails('au * x bwipe', 'E1155:')
|
||||||
call assert_fails('next x', 'E93')
|
|
||||||
bwipe
|
|
||||||
au!
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_nocatch_wipe_dummy_buffer()
|
|
||||||
" Nasty autocommand: wipe buffer on any event.
|
|
||||||
au * x bwipe
|
|
||||||
call assert_fails('lv½ /x', 'E480')
|
|
||||||
au!
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_wipe_cbuffer()
|
|
||||||
sv x
|
|
||||||
au * * bw
|
|
||||||
lb
|
|
||||||
au!
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test TextChangedI and TextChangedP
|
" Test TextChangedI and TextChangedP
|
||||||
|
@@ -3540,7 +3540,7 @@ func Test_lbuffer_crash()
|
|||||||
sv Xtest
|
sv Xtest
|
||||||
augroup QF_Test
|
augroup QF_Test
|
||||||
au!
|
au!
|
||||||
au * * bw
|
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * bw
|
||||||
augroup END
|
augroup END
|
||||||
lbuffer
|
lbuffer
|
||||||
augroup QF_Test
|
augroup QF_Test
|
||||||
@@ -3552,7 +3552,7 @@ endfunc
|
|||||||
func Test_lexpr_crash()
|
func Test_lexpr_crash()
|
||||||
augroup QF_Test
|
augroup QF_Test
|
||||||
au!
|
au!
|
||||||
au * * call setloclist(0, [], 'f')
|
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * call setloclist(0, [], 'f')
|
||||||
augroup END
|
augroup END
|
||||||
lexpr ""
|
lexpr ""
|
||||||
augroup QF_Test
|
augroup QF_Test
|
||||||
@@ -3587,7 +3587,7 @@ func Test_lvimgrep_crash()
|
|||||||
sv Xtest
|
sv Xtest
|
||||||
augroup QF_Test
|
augroup QF_Test
|
||||||
au!
|
au!
|
||||||
au * * call setloclist(0, [], 'f')
|
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * call setloclist(0, [], 'f')
|
||||||
augroup END
|
augroup END
|
||||||
lvimgrep quickfix test_quickfix.vim
|
lvimgrep quickfix test_quickfix.vim
|
||||||
augroup QF_Test
|
augroup QF_Test
|
||||||
@@ -3889,7 +3889,7 @@ func Test_lbuffer_with_bwipe()
|
|||||||
new
|
new
|
||||||
new
|
new
|
||||||
augroup nasty
|
augroup nasty
|
||||||
au * * bwipe
|
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * bwipe
|
||||||
augroup END
|
augroup END
|
||||||
lbuffer
|
lbuffer
|
||||||
augroup nasty
|
augroup nasty
|
||||||
@@ -3902,9 +3902,9 @@ endfunc
|
|||||||
func Xexpr_acmd_freelist(cchar)
|
func Xexpr_acmd_freelist(cchar)
|
||||||
call s:setup_commands(a:cchar)
|
call s:setup_commands(a:cchar)
|
||||||
|
|
||||||
" This was using freed memory.
|
" This was using freed memory (but with what events?)
|
||||||
augroup nasty
|
augroup nasty
|
||||||
au * * call g:Xsetlist([], 'f')
|
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * call g:Xsetlist([], 'f')
|
||||||
augroup END
|
augroup END
|
||||||
Xexpr "x"
|
Xexpr "x"
|
||||||
augroup nasty
|
augroup nasty
|
||||||
|
@@ -513,8 +513,8 @@ func Test_window_colon_command()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_access_freed_mem()
|
func Test_access_freed_mem()
|
||||||
" This was accessing freed memory
|
" This was accessing freed memory (but with what events?)
|
||||||
au * 0 vs xxx
|
au BufEnter,BufLeave,WinEnter,WinLeave 0 vs xxx
|
||||||
arg 0
|
arg 0
|
||||||
argadd
|
argadd
|
||||||
all
|
all
|
||||||
|
Reference in New Issue
Block a user