1
0
forked from aniani/vim

updated for version 7.4.486

Problem:    Check for writing to a yank register is wrong.
Solution:   Negate the check. (Zyx).  Also clean up the #ifdefs.
This commit is contained in:
Bram Moolenaar
2014-10-21 20:01:58 +02:00
parent 4920a44271
commit 958636c406
3 changed files with 21 additions and 42 deletions

View File

@@ -1153,8 +1153,6 @@ EX(CMD_tilde, "~", do_sub,
#endif #endif
}; };
#define USER_CMDIDX(idx) ((int)(idx) < 0)
#ifndef DO_DECLARE_EXCMD #ifndef DO_DECLARE_EXCMD
typedef enum CMD_index cmdidx_T; typedef enum CMD_index cmdidx_T;

View File

@@ -49,10 +49,15 @@ static void ex_delcommand __ARGS((exarg_T *eap));
static char_u *get_user_command_name __ARGS((int idx)); static char_u *get_user_command_name __ARGS((int idx));
# endif # endif
/* Wether a command index indicates a user command. */
# define IS_USER_CMDIDX(idx) ((int)(idx) < 0)
#else #else
# define ex_command ex_ni # define ex_command ex_ni
# define ex_comclear ex_ni # define ex_comclear ex_ni
# define ex_delcommand ex_ni # define ex_delcommand ex_ni
/* Wether a command index indicates a user command. */
# define IS_USER_CMDIDX(idx) (FALSE)
#endif #endif
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
@@ -2190,11 +2195,8 @@ do_one_cmd(cmdlinep, sourcing,
goto doend; goto doend;
} }
ni = ( ni = (!IS_USER_CMDIDX(ea.cmdidx)
#ifdef FEAT_USR_CMDS && (cmdnames[ea.cmdidx].cmd_func == ex_ni
!USER_CMDIDX(ea.cmdidx) &&
#endif
(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
@@ -2229,9 +2231,7 @@ do_one_cmd(cmdlinep, sourcing,
/* /*
* 5. parse arguments * 5. parse arguments
*/ */
#ifdef FEAT_USR_CMDS if (!IS_USER_CMDIDX(ea.cmdidx))
if (!USER_CMDIDX(ea.cmdidx))
#endif
ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
if (!ea.skip) if (!ea.skip)
@@ -2252,10 +2252,7 @@ do_one_cmd(cmdlinep, sourcing,
} }
if (text_locked() && !(ea.argt & CMDWIN) if (text_locked() && !(ea.argt & CMDWIN)
# ifdef FEAT_USR_CMDS && !IS_USER_CMDIDX(ea.cmdidx))
&& !USER_CMDIDX(ea.cmdidx)
# endif
)
{ {
/* Command not allowed when editing the command line. */ /* Command not allowed when editing the command line. */
#ifdef FEAT_CMDWIN #ifdef FEAT_CMDWIN
@@ -2273,9 +2270,7 @@ do_one_cmd(cmdlinep, sourcing,
if (!(ea.argt & CMDWIN) if (!(ea.argt & CMDWIN)
&& ea.cmdidx != CMD_edit && ea.cmdidx != CMD_edit
&& ea.cmdidx != CMD_checktime && ea.cmdidx != CMD_checktime
# ifdef FEAT_USR_CMDS && !IS_USER_CMDIDX(ea.cmdidx)
&& !USER_CMDIDX(ea.cmdidx)
# endif
&& curbuf_locked()) && curbuf_locked())
goto doend; goto doend;
#endif #endif
@@ -2468,10 +2463,8 @@ do_one_cmd(cmdlinep, sourcing,
/* accept numbered register only when no count allowed (:put) */ /* accept numbered register only when no count allowed (:put) */
if ( (ea.argt & REGSTR) if ( (ea.argt & REGSTR)
&& *ea.arg != NUL && *ea.arg != NUL
#ifdef FEAT_USR_CMDS /* Do not allow register = for user commands */
/* Do not allow register = for user commands */ && (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
&& (!USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
#endif
&& !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) && !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg)))
{ {
#ifndef FEAT_CLIPBOARD #ifndef FEAT_CLIPBOARD
@@ -2482,14 +2475,8 @@ do_one_cmd(cmdlinep, sourcing,
goto doend; goto doend;
} }
#endif #endif
if ( if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
#ifdef FEAT_USR_CMDS && !IS_USER_CMDIDX(ea.cmdidx))))
valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
&& USER_CMDIDX(ea.cmdidx)))
#else
valid_yank_reg(*ea.arg, ea.cmdidx != CMD_put)
#endif
)
{ {
ea.regname = *ea.arg++; ea.regname = *ea.arg++;
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
@@ -2663,10 +2650,7 @@ do_one_cmd(cmdlinep, sourcing,
* 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
# ifdef FEAT_USR_CMDS && !IS_USER_CMDIDX(ea.cmdidx))
&& !USER_CMDIDX(ea.cmdidx)
# endif
)
{ {
/* /*
* :bdelete, :bwipeout and :bunload take several arguments, separated * :bdelete, :bwipeout and :bunload take several arguments, separated
@@ -2704,7 +2688,7 @@ do_one_cmd(cmdlinep, sourcing,
#endif #endif
#ifdef FEAT_USR_CMDS #ifdef FEAT_USR_CMDS
if (USER_CMDIDX(ea.cmdidx)) if (IS_USER_CMDIDX(ea.cmdidx))
{ {
/* /*
* Execute a user-defined command. * Execute a user-defined command.
@@ -2763,11 +2747,8 @@ doend:
} }
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
do_errthrow(cstack, do_errthrow(cstack,
(ea.cmdidx != CMD_SIZE (ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx))
# ifdef FEAT_USR_CMDS ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL);
&& !USER_CMDIDX(ea.cmdidx)
# endif
) ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL);
#endif #endif
if (verbose_save >= 0) if (verbose_save >= 0)
@@ -3361,9 +3342,7 @@ set_one_cmd_context(xp, buff)
/* /*
* 5. parse arguments * 5. parse arguments
*/ */
#ifdef FEAT_USR_CMDS if (!IS_USER_CMDIDX(ea.cmdidx))
if (!USER_CMDIDX(ea.cmdidx))
#endif
ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
arg = skipwhite(p); arg = skipwhite(p);

View File

@@ -741,6 +741,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 */
/**/
486,
/**/ /**/
485, 485,
/**/ /**/