1
0
forked from aniani/vim

patch 8.2.5051: check for autocmd_add() event argument is confusing

Problem:    Check for autocmd_add() event argument is confusing.
Solution:   Make the code more straightforward.
This commit is contained in:
Bram Moolenaar
2022-06-01 16:02:38 +01:00
parent 409510c588
commit 882476ad7b
2 changed files with 8 additions and 8 deletions

View File

@@ -2951,26 +2951,24 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
if (eli == NULL)
break;
if (eli->li_tv.v_type != VAR_STRING
|| eli->li_tv.vval.v_string == NULL)
|| (p = eli->li_tv.vval.v_string) == NULL)
{
emsg(_(e_string_required));
continue;
break;
}
p = eli->li_tv.vval.v_string;
}
else
{
if (end == NULL)
p = end = event_name;
if (end == NULL || *end == NUL)
if (p == NULL)
p = event_name;
if (p == NULL || *p == NUL)
break;
}
if (p == NULL)
continue;
event = event_name2nr(p, &end);
if (event == NUM_EVENTS || *end != NUL)
{
// this also catches something following a valid event name
semsg(_(e_no_such_event_str), p);
retval = VVAL_FALSE;
break;

View File

@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
5051,
/**/
5050,
/**/