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