mirror of
https://github.com/vim/vim.git
synced 2025-07-25 10:54:51 -04:00
updated for version 7.3.054
Problem: Can define a user command for :Print, but it doesn't work. (Aaron Thoma) Solution: Let user command :Print overrule the builtin command (Christian Brabandt) Disallow :X and :Next as a user defined command.
This commit is contained in:
parent
2a8caa414e
commit
a3e7b1f42b
@ -2871,8 +2871,10 @@ find_command(eap, full)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_USR_CMDS
|
#ifdef FEAT_USR_CMDS
|
||||||
/* Look for a user defined command as a last resort */
|
/* Look for a user defined command as a last resort. Let ":Print" be
|
||||||
if (eap->cmdidx == CMD_SIZE && *eap->cmd >= 'A' && *eap->cmd <= 'Z')
|
* overruled by a user defined command. */
|
||||||
|
if ((eap->cmdidx == CMD_SIZE || eap->cmdidx == CMD_Print)
|
||||||
|
&& *eap->cmd >= 'A' && *eap->cmd <= 'Z')
|
||||||
{
|
{
|
||||||
/* User defined commands may contain digits. */
|
/* User defined commands may contain digits. */
|
||||||
while (ASCII_ISALNUM(*p))
|
while (ASCII_ISALNUM(*p))
|
||||||
@ -5588,6 +5590,7 @@ ex_command(eap)
|
|||||||
int compl = EXPAND_NOTHING;
|
int compl = EXPAND_NOTHING;
|
||||||
char_u *compl_arg = NULL;
|
char_u *compl_arg = NULL;
|
||||||
int has_attr = (eap->arg[0] == '-');
|
int has_attr = (eap->arg[0] == '-');
|
||||||
|
int name_len;
|
||||||
|
|
||||||
p = eap->arg;
|
p = eap->arg;
|
||||||
|
|
||||||
@ -5613,6 +5616,7 @@ ex_command(eap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
end = p;
|
end = p;
|
||||||
|
name_len = (int)(end - name);
|
||||||
|
|
||||||
/* If there is nothing after the name, and no attributes were specified,
|
/* If there is nothing after the name, and no attributes were specified,
|
||||||
* we are listing commands
|
* we are listing commands
|
||||||
@ -5627,6 +5631,13 @@ ex_command(eap)
|
|||||||
EMSG(_("E183: User defined commands must start with an uppercase letter"));
|
EMSG(_("E183: User defined commands must start with an uppercase letter"));
|
||||||
return;
|
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
|
else
|
||||||
uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
|
uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
|
||||||
eap->forceit);
|
eap->forceit);
|
||||||
@ -9394,7 +9405,7 @@ ex_findpat(eap)
|
|||||||
ex_ptag(eap)
|
ex_ptag(eap)
|
||||||
exarg_T *eap;
|
exarg_T *eap;
|
||||||
{
|
{
|
||||||
g_do_tagpreview = p_pvh;
|
g_do_tagpreview = p_pvh; /* will be reset to 0 in ex_tag_cmd() */
|
||||||
ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
|
ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,6 +714,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
54,
|
||||||
/**/
|
/**/
|
||||||
53,
|
53,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user