To: vim_dev@googlegroups.com Subject: Patch 7.4.486 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.486 Problem: Check for writing to a yank register is wrong. Solution: Negate the check. (Zyx). Also clean up the #ifdefs. Files: src/ex_docmd.c, src/ex_cmds.h *** ../vim-7.4.485/src/ex_docmd.c 2014-09-19 20:07:22.546449677 +0200 --- src/ex_docmd.c 2014-10-21 19:56:31.290287055 +0200 *************** *** 49,58 **** --- 49,63 ---- static char_u *get_user_command_name __ARGS((int idx)); # endif + /* Wether a command index indicates a user command. */ + # define IS_USER_CMDIDX(idx) ((int)(idx) < 0) + #else # define ex_command ex_ni # define ex_comclear ex_ni # define ex_delcommand ex_ni + /* Wether a command index indicates a user command. */ + # define IS_USER_CMDIDX(idx) (FALSE) #endif #ifdef FEAT_EVAL *************** *** 2190,2200 **** goto doend; } ! ni = ( ! #ifdef FEAT_USR_CMDS ! !USER_CMDIDX(ea.cmdidx) && ! #endif ! (cmdnames[ea.cmdidx].cmd_func == ex_ni #ifdef HAVE_EX_SCRIPT_NI || cmdnames[ea.cmdidx].cmd_func == ex_script_ni #endif --- 2195,2202 ---- goto doend; } ! ni = (!IS_USER_CMDIDX(ea.cmdidx) ! && (cmdnames[ea.cmdidx].cmd_func == ex_ni #ifdef HAVE_EX_SCRIPT_NI || cmdnames[ea.cmdidx].cmd_func == ex_script_ni #endif *************** *** 2229,2237 **** /* * 5. parse arguments */ ! #ifdef FEAT_USR_CMDS ! if (!USER_CMDIDX(ea.cmdidx)) ! #endif ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; if (!ea.skip) --- 2231,2237 ---- /* * 5. parse arguments */ ! if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; if (!ea.skip) *************** *** 2252,2261 **** } if (text_locked() && !(ea.argt & CMDWIN) ! # ifdef FEAT_USR_CMDS ! && !USER_CMDIDX(ea.cmdidx) ! # endif ! ) { /* Command not allowed when editing the command line. */ #ifdef FEAT_CMDWIN --- 2252,2258 ---- } if (text_locked() && !(ea.argt & CMDWIN) ! && !IS_USER_CMDIDX(ea.cmdidx)) { /* Command not allowed when editing the command line. */ #ifdef FEAT_CMDWIN *************** *** 2273,2281 **** if (!(ea.argt & CMDWIN) && ea.cmdidx != CMD_edit && ea.cmdidx != CMD_checktime ! # ifdef FEAT_USR_CMDS ! && !USER_CMDIDX(ea.cmdidx) ! # endif && curbuf_locked()) goto doend; #endif --- 2270,2276 ---- if (!(ea.argt & CMDWIN) && ea.cmdidx != CMD_edit && ea.cmdidx != CMD_checktime ! && !IS_USER_CMDIDX(ea.cmdidx) && curbuf_locked()) goto doend; #endif *************** *** 2468,2477 **** /* accept numbered register only when no count allowed (:put) */ if ( (ea.argt & REGSTR) && *ea.arg != NUL ! #ifdef FEAT_USR_CMDS ! /* Do not allow register = for user commands */ ! && (!USER_CMDIDX(ea.cmdidx) || *ea.arg != '=') ! #endif && !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) { #ifndef FEAT_CLIPBOARD --- 2463,2470 ---- /* accept numbered register only when no count allowed (:put) */ if ( (ea.argt & REGSTR) && *ea.arg != NUL ! /* Do not allow register = for user commands */ ! && (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=') && !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) { #ifndef FEAT_CLIPBOARD *************** *** 2482,2495 **** goto doend; } #endif ! if ( ! #ifdef FEAT_USR_CMDS ! 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++; #ifdef FEAT_EVAL --- 2475,2482 ---- goto doend; } #endif ! if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put ! && !IS_USER_CMDIDX(ea.cmdidx)))) { ea.regname = *ea.arg++; #ifdef FEAT_EVAL *************** *** 2663,2672 **** * number. Don't do this for a user command. */ if ((ea.argt & BUFNAME) && *ea.arg != NUL && ea.addr_count == 0 ! # ifdef FEAT_USR_CMDS ! && !USER_CMDIDX(ea.cmdidx) ! # endif ! ) { /* * :bdelete, :bwipeout and :bunload take several arguments, separated --- 2650,2656 ---- * number. Don't do this for a user command. */ if ((ea.argt & BUFNAME) && *ea.arg != NUL && ea.addr_count == 0 ! && !IS_USER_CMDIDX(ea.cmdidx)) { /* * :bdelete, :bwipeout and :bunload take several arguments, separated *************** *** 2704,2710 **** #endif #ifdef FEAT_USR_CMDS ! if (USER_CMDIDX(ea.cmdidx)) { /* * Execute a user-defined command. --- 2688,2694 ---- #endif #ifdef FEAT_USR_CMDS ! if (IS_USER_CMDIDX(ea.cmdidx)) { /* * Execute a user-defined command. *************** *** 2763,2773 **** } #ifdef FEAT_EVAL do_errthrow(cstack, ! (ea.cmdidx != CMD_SIZE ! # ifdef FEAT_USR_CMDS ! && !USER_CMDIDX(ea.cmdidx) ! # endif ! ) ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL); #endif if (verbose_save >= 0) --- 2747,2754 ---- } #ifdef FEAT_EVAL do_errthrow(cstack, ! (ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx)) ! ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL); #endif if (verbose_save >= 0) *************** *** 3361,3369 **** /* * 5. parse arguments */ ! #ifdef FEAT_USR_CMDS ! if (!USER_CMDIDX(ea.cmdidx)) ! #endif ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; arg = skipwhite(p); --- 3342,3348 ---- /* * 5. parse arguments */ ! if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; arg = skipwhite(p); *** ../vim-7.4.485/src/ex_cmds.h 2014-09-19 20:07:22.546449677 +0200 --- src/ex_cmds.h 2014-10-21 19:52:45.926286562 +0200 *************** *** 1153,1160 **** #endif }; - #define USER_CMDIDX(idx) ((int)(idx) < 0) - #ifndef DO_DECLARE_EXCMD typedef enum CMD_index cmdidx_T; --- 1153,1158 ---- *** ../vim-7.4.485/src/version.c 2014-10-21 19:35:28.406284296 +0200 --- src/version.c 2014-10-21 20:00:44.350287607 +0200 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 486, /**/ -- FATHER: One day, lad, all this will be yours ... PRINCE: What - the curtains? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///