Karsten Hopp 3fb1d0
To: vim-dev@vim.org
Karsten Hopp 3fb1d0
Subject: Patch 7.0.141
Karsten Hopp 3fb1d0
Fcc: outbox
Karsten Hopp 3fb1d0
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 3fb1d0
Mime-Version: 1.0
Karsten Hopp 3fb1d0
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 3fb1d0
Content-Transfer-Encoding: 8bit
Karsten Hopp 3fb1d0
------------
Karsten Hopp 3fb1d0
Karsten Hopp 3fb1d0
Patch 7.0.141
Karsten Hopp 3fb1d0
Problem:    When pasting a while line on the command line an extra CR is added
Karsten Hopp 3fb1d0
	    literally.
Karsten Hopp 3fb1d0
Solution:   Don't add the trailing CR when pasting with the mouse.
Karsten Hopp 3fb1d0
Files:	    src/ex_getln.c, src/proto/ops.pro, src/ops.c
Karsten Hopp 3fb1d0
Karsten Hopp 3fb1d0
Karsten Hopp 3fb1d0
*** ../vim-7.0.140/src/ex_getln.c	Thu Sep 14 11:27:12 2006
Karsten Hopp 3fb1d0
--- src/ex_getln.c	Sun Oct 15 16:17:20 2006
Karsten Hopp 3fb1d0
***************
Karsten Hopp 3fb1d0
*** 86,92 ****
Karsten Hopp 3fb1d0
  static void	draw_cmdline __ARGS((int start, int len));
Karsten Hopp 3fb1d0
  static void	save_cmdline __ARGS((struct cmdline_info *ccp));
Karsten Hopp 3fb1d0
  static void	restore_cmdline __ARGS((struct cmdline_info *ccp));
Karsten Hopp 3fb1d0
! static int	cmdline_paste __ARGS((int regname, int literally));
Karsten Hopp 3fb1d0
  #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
Karsten Hopp 3fb1d0
  static void	redrawcmd_preedit __ARGS((void));
Karsten Hopp 3fb1d0
  #endif
Karsten Hopp 3fb1d0
--- 86,92 ----
Karsten Hopp 3fb1d0
  static void	draw_cmdline __ARGS((int start, int len));
Karsten Hopp 3fb1d0
  static void	save_cmdline __ARGS((struct cmdline_info *ccp));
Karsten Hopp 3fb1d0
  static void	restore_cmdline __ARGS((struct cmdline_info *ccp));
Karsten Hopp 3fb1d0
! static int	cmdline_paste __ARGS((int regname, int literally, int remcr));
Karsten Hopp 3fb1d0
  #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
Karsten Hopp 3fb1d0
  static void	redrawcmd_preedit __ARGS((void));
Karsten Hopp 3fb1d0
  #endif
Karsten Hopp 3fb1d0
***************
Karsten Hopp 3fb1d0
*** 1116,1122 ****
Karsten Hopp 3fb1d0
  #endif
Karsten Hopp 3fb1d0
  		if (c != ESC)	    /* use ESC to cancel inserting register */
Karsten Hopp 3fb1d0
  		{
Karsten Hopp 3fb1d0
! 		    cmdline_paste(c, i == Ctrl_R);
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
  #ifdef FEAT_EVAL
Karsten Hopp 3fb1d0
  		    /* When there was a serious error abort getting the
Karsten Hopp 3fb1d0
--- 1116,1122 ----
Karsten Hopp 3fb1d0
  #endif
Karsten Hopp 3fb1d0
  		if (c != ESC)	    /* use ESC to cancel inserting register */
Karsten Hopp 3fb1d0
  		{
Karsten Hopp 3fb1d0
! 		    cmdline_paste(c, i == Ctrl_R, FALSE);
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
  #ifdef FEAT_EVAL
Karsten Hopp 3fb1d0
  		    /* When there was a serious error abort getting the
Karsten Hopp 3fb1d0
***************
Karsten Hopp 3fb1d0
*** 1231,1246 ****
Karsten Hopp 3fb1d0
  			goto cmdline_not_changed;   /* Ignore mouse */
Karsten Hopp 3fb1d0
  # ifdef FEAT_CLIPBOARD
Karsten Hopp 3fb1d0
  		if (clip_star.available)
Karsten Hopp 3fb1d0
! 		    cmdline_paste('*', TRUE);
Karsten Hopp 3fb1d0
  		else
Karsten Hopp 3fb1d0
  # endif
Karsten Hopp 3fb1d0
! 		    cmdline_paste(0, TRUE);
Karsten Hopp 3fb1d0
  		redrawcmd();
Karsten Hopp 3fb1d0
  		goto cmdline_changed;
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
  # ifdef FEAT_DND
Karsten Hopp 3fb1d0
  	case K_DROP:
Karsten Hopp 3fb1d0
! 		cmdline_paste('~', TRUE);
Karsten Hopp 3fb1d0
  		redrawcmd();
Karsten Hopp 3fb1d0
  		goto cmdline_changed;
Karsten Hopp 3fb1d0
  # endif
Karsten Hopp 3fb1d0
--- 1231,1246 ----
Karsten Hopp 3fb1d0
  			goto cmdline_not_changed;   /* Ignore mouse */
Karsten Hopp 3fb1d0
  # ifdef FEAT_CLIPBOARD
Karsten Hopp 3fb1d0
  		if (clip_star.available)
Karsten Hopp 3fb1d0
! 		    cmdline_paste('*', TRUE, TRUE);
Karsten Hopp 3fb1d0
  		else
Karsten Hopp 3fb1d0
  # endif
Karsten Hopp 3fb1d0
! 		    cmdline_paste(0, TRUE, TRUE);
Karsten Hopp 3fb1d0
  		redrawcmd();
Karsten Hopp 3fb1d0
  		goto cmdline_changed;
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
  # ifdef FEAT_DND
Karsten Hopp 3fb1d0
  	case K_DROP:
Karsten Hopp 3fb1d0
! 		cmdline_paste('~', TRUE, FALSE);
Karsten Hopp 3fb1d0
  		redrawcmd();
Karsten Hopp 3fb1d0
  		goto cmdline_changed;
Karsten Hopp 3fb1d0
  # endif
Karsten Hopp 3fb1d0
***************
Karsten Hopp 3fb1d0
*** 2890,2898 ****
Karsten Hopp 3fb1d0
   * return FAIL for failure, OK otherwise
Karsten Hopp 3fb1d0
   */
Karsten Hopp 3fb1d0
      static int
Karsten Hopp 3fb1d0
! cmdline_paste(regname, literally)
Karsten Hopp 3fb1d0
      int regname;
Karsten Hopp 3fb1d0
      int literally;	/* Insert text literally instead of "as typed" */
Karsten Hopp 3fb1d0
  {
Karsten Hopp 3fb1d0
      long		i;
Karsten Hopp 3fb1d0
      char_u		*arg;
Karsten Hopp 3fb1d0
--- 2890,2899 ----
Karsten Hopp 3fb1d0
   * return FAIL for failure, OK otherwise
Karsten Hopp 3fb1d0
   */
Karsten Hopp 3fb1d0
      static int
Karsten Hopp 3fb1d0
! cmdline_paste(regname, literally, remcr)
Karsten Hopp 3fb1d0
      int regname;
Karsten Hopp 3fb1d0
      int literally;	/* Insert text literally instead of "as typed" */
Karsten Hopp 3fb1d0
+     int remcr;		/* remove trailing CR */
Karsten Hopp 3fb1d0
  {
Karsten Hopp 3fb1d0
      long		i;
Karsten Hopp 3fb1d0
      char_u		*arg;
Karsten Hopp 3fb1d0
***************
Karsten Hopp 3fb1d0
*** 2968,2974 ****
Karsten Hopp 3fb1d0
  	return OK;
Karsten Hopp 3fb1d0
      }
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
!     return cmdline_paste_reg(regname, literally);
Karsten Hopp 3fb1d0
  }
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
  /*
Karsten Hopp 3fb1d0
--- 2969,2975 ----
Karsten Hopp 3fb1d0
  	return OK;
Karsten Hopp 3fb1d0
      }
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
!     return cmdline_paste_reg(regname, literally, remcr);
Karsten Hopp 3fb1d0
  }
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
  /*
Karsten Hopp 3fb1d0
*** ../vim-7.0.140/src/proto/ops.pro	Sun Apr 30 20:25:07 2006
Karsten Hopp 3fb1d0
--- src/proto/ops.pro	Tue Oct 17 16:24:08 2006
Karsten Hopp 3fb1d0
***************
Karsten Hopp 3fb1d0
*** 20,26 ****
Karsten Hopp 3fb1d0
  extern int do_execreg __ARGS((int regname, int colon, int addcr));
Karsten Hopp 3fb1d0
  extern int insert_reg __ARGS((int regname, int literally));
Karsten Hopp 3fb1d0
  extern int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg));
Karsten Hopp 3fb1d0
! extern int cmdline_paste_reg __ARGS((int regname, int literally));
Karsten Hopp 3fb1d0
  extern void adjust_clip_reg __ARGS((int *rp));
Karsten Hopp 3fb1d0
  extern int op_delete __ARGS((oparg_T *oap));
Karsten Hopp 3fb1d0
  extern int op_replace __ARGS((oparg_T *oap, int c));
Karsten Hopp 3fb1d0
--- 20,26 ----
Karsten Hopp 3fb1d0
  extern int do_execreg __ARGS((int regname, int colon, int addcr));
Karsten Hopp 3fb1d0
  extern int insert_reg __ARGS((int regname, int literally));
Karsten Hopp 3fb1d0
  extern int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg));
Karsten Hopp 3fb1d0
! extern int cmdline_paste_reg __ARGS((int regname, int literally, int remcr));
Karsten Hopp 3fb1d0
  extern void adjust_clip_reg __ARGS((int *rp));
Karsten Hopp 3fb1d0
  extern int op_delete __ARGS((oparg_T *oap));
Karsten Hopp 3fb1d0
  extern int op_replace __ARGS((oparg_T *oap, int c));
Karsten Hopp 3fb1d0
*** ../vim-7.0.140/src/ops.c	Fri Oct  6 23:33:22 2006
Karsten Hopp 3fb1d0
--- src/ops.c	Sun Oct 15 16:43:54 2006
Karsten Hopp 3fb1d0
***************
Karsten Hopp 3fb1d0
*** 1480,1488 ****
Karsten Hopp 3fb1d0
   * return FAIL for failure, OK otherwise
Karsten Hopp 3fb1d0
   */
Karsten Hopp 3fb1d0
      int
Karsten Hopp 3fb1d0
! cmdline_paste_reg(regname, literally)
Karsten Hopp 3fb1d0
      int regname;
Karsten Hopp 3fb1d0
      int literally;	/* Insert text literally instead of "as typed" */
Karsten Hopp 3fb1d0
  {
Karsten Hopp 3fb1d0
      long	i;
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
--- 1481,1490 ----
Karsten Hopp 3fb1d0
   * return FAIL for failure, OK otherwise
Karsten Hopp 3fb1d0
   */
Karsten Hopp 3fb1d0
      int
Karsten Hopp 3fb1d0
! cmdline_paste_reg(regname, literally, remcr)
Karsten Hopp 3fb1d0
      int regname;
Karsten Hopp 3fb1d0
      int literally;	/* Insert text literally instead of "as typed" */
Karsten Hopp 3fb1d0
+     int remcr;		/* don't add trailing CR */
Karsten Hopp 3fb1d0
  {
Karsten Hopp 3fb1d0
      long	i;
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
***************
Karsten Hopp 3fb1d0
*** 1494,1501 ****
Karsten Hopp 3fb1d0
      {
Karsten Hopp 3fb1d0
  	cmdline_paste_str(y_current->y_array[i], literally);
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
! 	/* insert ^M between lines and after last line if type is MLINE */
Karsten Hopp 3fb1d0
! 	if (y_current->y_type == MLINE || i < y_current->y_size - 1)
Karsten Hopp 3fb1d0
  	    cmdline_paste_str((char_u *)"\r", literally);
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
  	/* Check for CTRL-C, in case someone tries to paste a few thousand
Karsten Hopp 3fb1d0
--- 1496,1508 ----
Karsten Hopp 3fb1d0
      {
Karsten Hopp 3fb1d0
  	cmdline_paste_str(y_current->y_array[i], literally);
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
! 	/* Insert ^M between lines and after last line if type is MLINE.
Karsten Hopp 3fb1d0
! 	 * Don't do this when "remcr" is TRUE and the next line is empty. */
Karsten Hopp 3fb1d0
! 	if (y_current->y_type == MLINE
Karsten Hopp 3fb1d0
! 		|| (i < y_current->y_size - 1
Karsten Hopp 3fb1d0
! 		    && !(remcr
Karsten Hopp 3fb1d0
! 			&& i == y_current->y_size - 2
Karsten Hopp 3fb1d0
! 			&& *y_current->y_array[i + 1] == NUL)))
Karsten Hopp 3fb1d0
  	    cmdline_paste_str((char_u *)"\r", literally);
Karsten Hopp 3fb1d0
  
Karsten Hopp 3fb1d0
  	/* Check for CTRL-C, in case someone tries to paste a few thousand
Karsten Hopp 3fb1d0
*** ../vim-7.0.140/src/version.c	Tue Oct 17 15:17:41 2006
Karsten Hopp 3fb1d0
--- src/version.c	Tue Oct 17 16:22:55 2006
Karsten Hopp 3fb1d0
***************
Karsten Hopp 3fb1d0
*** 668,669 ****
Karsten Hopp 3fb1d0
--- 668,671 ----
Karsten Hopp 3fb1d0
  {   /* Add new patch number below this line */
Karsten Hopp 3fb1d0
+ /**/
Karsten Hopp 3fb1d0
+     141,
Karsten Hopp 3fb1d0
  /**/
Karsten Hopp 3fb1d0
Karsten Hopp 3fb1d0
-- 
Karsten Hopp 3fb1d0
ERROR 047: Keyboard not found.  Press RETURN to continue.
Karsten Hopp 3fb1d0
Karsten Hopp 3fb1d0
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 3fb1d0
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 3fb1d0
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 3fb1d0
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///