mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
commit
1c6cd9f239
@ -88,8 +88,6 @@ typedef struct cmdname {
|
|||||||
long_u cmd_argt; ///< Relevant flags from the declared above.
|
long_u cmd_argt; ///< Relevant flags from the declared above.
|
||||||
} CommandDefinition;
|
} CommandDefinition;
|
||||||
|
|
||||||
#define USER_CMDIDX(idx) ((int)(idx) < 0)
|
|
||||||
|
|
||||||
/// Arguments used for Ex commands.
|
/// Arguments used for Ex commands.
|
||||||
struct exarg {
|
struct exarg {
|
||||||
char_u *arg; ///< argument of the command
|
char_u *arg; ///< argument of the command
|
||||||
|
@ -92,6 +92,9 @@ static garray_T ucmds = {0, 0, sizeof(ucmd_T), 4, NULL};
|
|||||||
#define USER_CMD(i) (&((ucmd_T *)(ucmds.ga_data))[i])
|
#define USER_CMD(i) (&((ucmd_T *)(ucmds.ga_data))[i])
|
||||||
#define USER_CMD_GA(gap, i) (&((ucmd_T *)((gap)->ga_data))[i])
|
#define USER_CMD_GA(gap, i) (&((ucmd_T *)((gap)->ga_data))[i])
|
||||||
|
|
||||||
|
/* Wether a command index indicates a user command. */
|
||||||
|
# define IS_USER_CMDIDX(idx) ((int)(idx) < 0)
|
||||||
|
|
||||||
/* Struct for storing a line inside a while/for loop */
|
/* Struct for storing a line inside a while/for loop */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char_u *line; /* command line */
|
char_u *line; /* command line */
|
||||||
@ -1489,11 +1492,10 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
goto doend;
|
goto doend;
|
||||||
}
|
}
|
||||||
|
|
||||||
ni = (
|
ni = (!IS_USER_CMDIDX(ea.cmdidx)
|
||||||
!USER_CMDIDX(ea.cmdidx) &&
|
&& (cmdnames[ea.cmdidx].cmd_func == ex_ni
|
||||||
(cmdnames[ea.cmdidx].cmd_func == ex_ni
|
|
||||||
#ifdef HAVE_EX_SCRIPT_NI
|
#ifdef HAVE_EX_SCRIPT_NI
|
||||||
|| cmdnames[ea.cmdidx].cmd_func == ex_script_ni
|
|| cmdnames[ea.cmdidx].cmd_func == ex_script_ni
|
||||||
#endif
|
#endif
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -1509,8 +1511,9 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
/*
|
/*
|
||||||
* 5. parse arguments
|
* 5. parse arguments
|
||||||
*/
|
*/
|
||||||
if (!USER_CMDIDX(ea.cmdidx))
|
if (!IS_USER_CMDIDX(ea.cmdidx)) {
|
||||||
ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
|
ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ea.skip) {
|
if (!ea.skip) {
|
||||||
#ifdef HAVE_SANDBOX
|
#ifdef HAVE_SANDBOX
|
||||||
@ -1527,8 +1530,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (text_locked() && !(ea.argt & CMDWIN)
|
if (text_locked() && !(ea.argt & CMDWIN)
|
||||||
&& !USER_CMDIDX(ea.cmdidx)
|
&& !IS_USER_CMDIDX(ea.cmdidx)) {
|
||||||
) {
|
|
||||||
/* Command not allowed when editing the command line. */
|
/* Command not allowed when editing the command line. */
|
||||||
if (cmdwin_type != 0)
|
if (cmdwin_type != 0)
|
||||||
errormsg = (char_u *)_(e_cmdwin);
|
errormsg = (char_u *)_(e_cmdwin);
|
||||||
@ -1542,7 +1544,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
if (!(ea.argt & CMDWIN)
|
if (!(ea.argt & CMDWIN)
|
||||||
&& ea.cmdidx != CMD_edit
|
&& ea.cmdidx != CMD_edit
|
||||||
&& ea.cmdidx != CMD_checktime
|
&& ea.cmdidx != CMD_checktime
|
||||||
&& !USER_CMDIDX(ea.cmdidx)
|
&& !IS_USER_CMDIDX(ea.cmdidx)
|
||||||
&& curbuf_locked())
|
&& curbuf_locked())
|
||||||
goto doend;
|
goto doend;
|
||||||
|
|
||||||
@ -1708,17 +1710,15 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
if ( (ea.argt & REGSTR)
|
if ( (ea.argt & REGSTR)
|
||||||
&& *ea.arg != NUL
|
&& *ea.arg != NUL
|
||||||
/* Do not allow register = for user commands */
|
/* Do not allow register = for user commands */
|
||||||
&& (!USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
|
&& (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
|
||||||
&& !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) {
|
&& !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) {
|
||||||
/* check these explicitly for a more specific error message */
|
/* check these explicitly for a more specific error message */
|
||||||
if (*ea.arg == '*' || *ea.arg == '+') {
|
if (*ea.arg == '*' || *ea.arg == '+') {
|
||||||
errormsg = (char_u *)_(e_invalidreg);
|
errormsg = (char_u *)_(e_invalidreg);
|
||||||
goto doend;
|
goto doend;
|
||||||
}
|
}
|
||||||
if (
|
if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
|
||||||
valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
|
&& !IS_USER_CMDIDX(ea.cmdidx)))) {
|
||||||
&& USER_CMDIDX(ea.cmdidx)))
|
|
||||||
) {
|
|
||||||
ea.regname = *ea.arg++;
|
ea.regname = *ea.arg++;
|
||||||
/* for '=' register: accept the rest of the line as an expression */
|
/* for '=' register: accept the rest of the line as an expression */
|
||||||
if (ea.arg[-1] == '=' && ea.arg[0] != NUL) {
|
if (ea.arg[-1] == '=' && ea.arg[0] != NUL) {
|
||||||
@ -1868,7 +1868,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
* number. Don't do this for a user command.
|
* number. Don't do this for a user command.
|
||||||
*/
|
*/
|
||||||
if ((ea.argt & BUFNAME) && *ea.arg != NUL && ea.addr_count == 0
|
if ((ea.argt & BUFNAME) && *ea.arg != NUL && ea.addr_count == 0
|
||||||
&& !USER_CMDIDX(ea.cmdidx)
|
&& !IS_USER_CMDIDX(ea.cmdidx)
|
||||||
) {
|
) {
|
||||||
/*
|
/*
|
||||||
* :bdelete, :bwipeout and :bunload take several arguments, separated
|
* :bdelete, :bwipeout and :bunload take several arguments, separated
|
||||||
@ -1901,7 +1901,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
ea.cookie = cookie;
|
ea.cookie = cookie;
|
||||||
ea.cstack = cstack;
|
ea.cstack = cstack;
|
||||||
|
|
||||||
if (USER_CMDIDX(ea.cmdidx)) {
|
if (IS_USER_CMDIDX(ea.cmdidx)) {
|
||||||
/*
|
/*
|
||||||
* Execute a user-defined command.
|
* Execute a user-defined command.
|
||||||
*/
|
*/
|
||||||
@ -1949,9 +1949,9 @@ doend:
|
|||||||
emsg(errormsg);
|
emsg(errormsg);
|
||||||
}
|
}
|
||||||
do_errthrow(cstack,
|
do_errthrow(cstack,
|
||||||
(ea.cmdidx != CMD_SIZE
|
(ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx))
|
||||||
&& !USER_CMDIDX(ea.cmdidx)
|
? cmdnames[(int)ea.cmdidx].cmd_name
|
||||||
) ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL);
|
: (char_u *)NULL);
|
||||||
|
|
||||||
if (verbose_save >= 0)
|
if (verbose_save >= 0)
|
||||||
p_verbose = verbose_save;
|
p_verbose = verbose_save;
|
||||||
@ -2464,8 +2464,9 @@ set_one_cmd_context (
|
|||||||
/*
|
/*
|
||||||
* 5. parse arguments
|
* 5. parse arguments
|
||||||
*/
|
*/
|
||||||
if (!USER_CMDIDX(ea.cmdidx))
|
if (!IS_USER_CMDIDX(ea.cmdidx)) {
|
||||||
ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
|
ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
|
||||||
|
}
|
||||||
|
|
||||||
arg = skipwhite(p);
|
arg = skipwhite(p);
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ static int included_patches[] = {
|
|||||||
489,
|
489,
|
||||||
488,
|
488,
|
||||||
//487,
|
//487,
|
||||||
//486,
|
486,
|
||||||
485,
|
485,
|
||||||
//484 NA
|
//484 NA
|
||||||
483,
|
483,
|
||||||
|
Loading…
Reference in New Issue
Block a user