Blob Blame History Raw
To: vim-dev@vim.org
Subject: patch 7.0.203
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.0.203
Problem:    0x80 characters in a register are not handled correctly for the
	    "@" command.
Solution:   Escape CSI and 0x80 characters. (Yukihiro Nakadaira)
Files:	    src/ops.c


*** ../vim-7.0.202/src/ops.c	Tue Nov  7 18:43:10 2006
--- src/ops.c	Tue Feb 27 17:24:02 2007
***************
*** 96,102 ****
  #endif
  static int	stuff_yank __ARGS((int, char_u *));
  static void	put_reedit_in_typebuf __ARGS((int silent));
! static int	put_in_typebuf __ARGS((char_u *s, int colon, int silent));
  static void	stuffescaped __ARGS((char_u *arg, int literally));
  #ifdef FEAT_MBYTE
  static void	mb_adjust_opend __ARGS((oparg_T *oap));
--- 96,103 ----
  #endif
  static int	stuff_yank __ARGS((int, char_u *));
  static void	put_reedit_in_typebuf __ARGS((int silent));
! static int	put_in_typebuf __ARGS((char_u *s, int esc, int colon,
! 								 int silent));
  static void	stuffescaped __ARGS((char_u *arg, int literally));
  #ifdef FEAT_MBYTE
  static void	mb_adjust_opend __ARGS((oparg_T *oap));
***************
*** 1174,1182 ****
  	    /* When in Visual mode "'<,'>" will be prepended to the command.
  	     * Remove it when it's already there. */
  	    if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0)
! 		retval = put_in_typebuf(p + 5, TRUE, silent);
  	    else
! 		retval = put_in_typebuf(p, TRUE, silent);
  	}
  	vim_free(p);
      }
--- 1175,1183 ----
  	    /* When in Visual mode "'<,'>" will be prepended to the command.
  	     * Remove it when it's already there. */
  	    if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0)
! 		retval = put_in_typebuf(p + 5, TRUE, TRUE, silent);
  	    else
! 		retval = put_in_typebuf(p, TRUE, TRUE, silent);
  	}
  	vim_free(p);
      }
***************
*** 1187,1193 ****
  	p = get_expr_line();
  	if (p == NULL)
  	    return FAIL;
! 	retval = put_in_typebuf(p, colon, silent);
  	vim_free(p);
      }
  #endif
--- 1188,1194 ----
  	p = get_expr_line();
  	if (p == NULL)
  	    return FAIL;
! 	retval = put_in_typebuf(p, TRUE, colon, silent);
  	vim_free(p);
      }
  #endif
***************
*** 1199,1205 ****
  	    EMSG(_(e_noinstext));
  	    return FAIL;
  	}
! 	retval = put_in_typebuf(p, colon, silent);
  	vim_free(p);
      }
      else
--- 1200,1206 ----
  	    EMSG(_(e_noinstext));
  	    return FAIL;
  	}
! 	retval = put_in_typebuf(p, FALSE, colon, silent);
  	vim_free(p);
      }
      else
***************
*** 1217,1222 ****
--- 1218,1225 ----
  	put_reedit_in_typebuf(silent);
  	for (i = y_current->y_size; --i >= 0; )
  	{
+ 	    char_u *escaped;
+ 
  	    /* insert NL between lines and after last line if type is MLINE */
  	    if (y_current->y_type == MLINE || i < y_current->y_size - 1
  								     || addcr)
***************
*** 1224,1231 ****
  		if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, silent) == FAIL)
  		    return FAIL;
  	    }
! 	    if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, silent)
! 								      == FAIL)
  		return FAIL;
  	    if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent)
  								      == FAIL)
--- 1227,1238 ----
  		if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, silent) == FAIL)
  		    return FAIL;
  	    }
! 	    escaped = vim_strsave_escape_csi(y_current->y_array[i]);
! 	    if (escaped == NULL)
! 		return FAIL;
! 	    retval = ins_typebuf(escaped, remap, 0, TRUE, silent);
! 	    vim_free(escaped);
! 	    if (retval == FAIL)
  		return FAIL;
  	    if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent)
  								      == FAIL)
***************
*** 1265,1272 ****
  }
  
      static int
! put_in_typebuf(s, colon, silent)
      char_u	*s;
      int		colon;	    /* add ':' before the line */
      int		silent;
  {
--- 1272,1280 ----
  }
  
      static int
! put_in_typebuf(s, esc, colon, silent)
      char_u	*s;
+     int		esc;	    /* Escape CSI characters */
      int		colon;	    /* add ':' before the line */
      int		silent;
  {
***************
*** 1276,1282 ****
      if (colon)
  	retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent);
      if (retval == OK)
! 	retval = ins_typebuf(s, REMAP_YES, 0, TRUE, silent);
      if (colon && retval == OK)
  	retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, silent);
      return retval;
--- 1284,1303 ----
      if (colon)
  	retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent);
      if (retval == OK)
!     {
! 	char_u	*p;
! 
! 	if (esc)
! 	    p = vim_strsave_escape_csi(s);
! 	else
! 	    p = s;
! 	if (p == NULL)
! 	    retval = FAIL;
! 	else
! 	    retval = ins_typebuf(p, REMAP_YES, 0, TRUE, silent);
! 	if (esc)
! 	    vim_free(p);
!     }
      if (colon && retval == OK)
  	retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, silent);
      return retval;
*** ../vim-7.0.202/src/version.c	Tue Feb 27 16:51:07 2007
--- src/version.c	Tue Feb 27 17:22:13 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     203,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
215. Your mouse-clicking forearm rivals Popeye's.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///