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().
Commit dc5f4a3cc2 should have removed it.
This commit is contained in:
Jan Edmund Lazo
2021-01-28 23:06:30 -05:00
parent f05ffaef1c
commit c77b679ecd
5 changed files with 22 additions and 33 deletions

View File

@@ -700,11 +700,15 @@ void do_autocmd(char_u *arg_in, int forceit)
last_event = (event_T)-1; // for listing the event name
last_group = AUGROUP_ERROR; // for listing the group name
if (*arg == '*' || *arg == NUL || *arg == '|') {
for (event_T event = (event_T)0; event < (int)NUM_EVENTS;
event = (event_T)(event + 1)) {
if (do_autocmd_event(event, pat, once, nested, cmd, forceit, group)
== FAIL) {
break;
if (!forceit && *cmd != NUL) {
EMSG(_(e_cannot_define_autocommands_for_all_events));
} else {
for (event_T event = (event_T)0; event < (int)NUM_EVENTS;
event = (event_T)(event + 1)) {
if (do_autocmd_event(event, pat, once, nested, cmd, forceit, group)
== FAIL) {
break;
}
}
}
} else {