1
0
forked from aniani/vim

patch 8.2.3141: no error when using :complete for :command without -nargs

Problem:    No error when using :complete for :command without -nargs.
Solution:   Give an error. (Martin Tournoij, closes #8544, closes #8541)
This commit is contained in:
Martin Tournoij
2021-07-11 14:28:25 +02:00
committed by Bram Moolenaar
parent 482d2f37a5
commit de69a7353e
4 changed files with 23 additions and 27 deletions

View File

@@ -1019,21 +1019,15 @@ ex_command(exarg_T *eap)
// we are listing commands
p = skipwhite(end);
if (!has_attr && ends_excmd2(eap->arg, p))
{
uc_list(name, end - name);
}
else if (!ASCII_ISUPPER(*name))
{
emsg(_("E183: User defined commands must start with an uppercase letter"));
return;
}
else if ((name_len == 1 && *name == 'X')
|| (name_len <= 4
&& STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0))
{
emsg(_("E841: Reserved name, cannot be used for user defined command"));
return;
}
else if (compl > 0 && (argt & EX_EXTRA) == 0)
emsg(_(e_complete_used_without_nargs));
else
uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
addr_type_arg, eap->forceit);