7458cd7
To: vim-dev@vim.org
7458cd7
Subject: patch 7.0.203
7458cd7
Fcc: outbox
7458cd7
From: Bram Moolenaar <Bram@moolenaar.net>
7458cd7
Mime-Version: 1.0
7458cd7
Content-Type: text/plain; charset=ISO-8859-1
7458cd7
Content-Transfer-Encoding: 8bit
7458cd7
------------
7458cd7
7458cd7
Patch 7.0.203
7458cd7
Problem:    0x80 characters in a register are not handled correctly for the
7458cd7
	    "@" command.
7458cd7
Solution:   Escape CSI and 0x80 characters. (Yukihiro Nakadaira)
7458cd7
Files:	    src/ops.c
7458cd7
7458cd7
7458cd7
*** ../vim-7.0.202/src/ops.c	Tue Nov  7 18:43:10 2006
7458cd7
--- src/ops.c	Tue Feb 27 17:24:02 2007
7458cd7
***************
7458cd7
*** 96,102 ****
7458cd7
  #endif
7458cd7
  static int	stuff_yank __ARGS((int, char_u *));
7458cd7
  static void	put_reedit_in_typebuf __ARGS((int silent));
7458cd7
! static int	put_in_typebuf __ARGS((char_u *s, int colon, int silent));
7458cd7
  static void	stuffescaped __ARGS((char_u *arg, int literally));
7458cd7
  #ifdef FEAT_MBYTE
7458cd7
  static void	mb_adjust_opend __ARGS((oparg_T *oap));
7458cd7
--- 96,103 ----
7458cd7
  #endif
7458cd7
  static int	stuff_yank __ARGS((int, char_u *));
7458cd7
  static void	put_reedit_in_typebuf __ARGS((int silent));
7458cd7
! static int	put_in_typebuf __ARGS((char_u *s, int esc, int colon,
7458cd7
! 								 int silent));
7458cd7
  static void	stuffescaped __ARGS((char_u *arg, int literally));
7458cd7
  #ifdef FEAT_MBYTE
7458cd7
  static void	mb_adjust_opend __ARGS((oparg_T *oap));
7458cd7
***************
7458cd7
*** 1174,1182 ****
7458cd7
  	    /* When in Visual mode "'<,'>" will be prepended to the command.
7458cd7
  	     * Remove it when it's already there. */
7458cd7
  	    if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0)
7458cd7
! 		retval = put_in_typebuf(p + 5, TRUE, silent);
7458cd7
  	    else
7458cd7
! 		retval = put_in_typebuf(p, TRUE, silent);
7458cd7
  	}
7458cd7
  	vim_free(p);
7458cd7
      }
7458cd7
--- 1175,1183 ----
7458cd7
  	    /* When in Visual mode "'<,'>" will be prepended to the command.
7458cd7
  	     * Remove it when it's already there. */
7458cd7
  	    if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0)
7458cd7
! 		retval = put_in_typebuf(p + 5, TRUE, TRUE, silent);
7458cd7
  	    else
7458cd7
! 		retval = put_in_typebuf(p, TRUE, TRUE, silent);
7458cd7
  	}
7458cd7
  	vim_free(p);
7458cd7
      }
7458cd7
***************
7458cd7
*** 1187,1193 ****
7458cd7
  	p = get_expr_line();
7458cd7
  	if (p == NULL)
7458cd7
  	    return FAIL;
7458cd7
! 	retval = put_in_typebuf(p, colon, silent);
7458cd7
  	vim_free(p);
7458cd7
      }
7458cd7
  #endif
7458cd7
--- 1188,1194 ----
7458cd7
  	p = get_expr_line();
7458cd7
  	if (p == NULL)
7458cd7
  	    return FAIL;
7458cd7
! 	retval = put_in_typebuf(p, TRUE, colon, silent);
7458cd7
  	vim_free(p);
7458cd7
      }
7458cd7
  #endif
7458cd7
***************
7458cd7
*** 1199,1205 ****
7458cd7
  	    EMSG(_(e_noinstext));
7458cd7
  	    return FAIL;
7458cd7
  	}
7458cd7
! 	retval = put_in_typebuf(p, colon, silent);
7458cd7
  	vim_free(p);
7458cd7
      }
7458cd7
      else
7458cd7
--- 1200,1206 ----
7458cd7
  	    EMSG(_(e_noinstext));
7458cd7
  	    return FAIL;
7458cd7
  	}
7458cd7
! 	retval = put_in_typebuf(p, FALSE, colon, silent);
7458cd7
  	vim_free(p);
7458cd7
      }
7458cd7
      else
7458cd7
***************
7458cd7
*** 1217,1222 ****
7458cd7
--- 1218,1225 ----
7458cd7
  	put_reedit_in_typebuf(silent);
7458cd7
  	for (i = y_current->y_size; --i >= 0; )
7458cd7
  	{
7458cd7
+ 	    char_u *escaped;
7458cd7
+ 
7458cd7
  	    /* insert NL between lines and after last line if type is MLINE */
7458cd7
  	    if (y_current->y_type == MLINE || i < y_current->y_size - 1
7458cd7
  								     || addcr)
7458cd7
***************
7458cd7
*** 1224,1231 ****
7458cd7
  		if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, silent) == FAIL)
7458cd7
  		    return FAIL;
7458cd7
  	    }
7458cd7
! 	    if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, silent)
7458cd7
! 								      == FAIL)
7458cd7
  		return FAIL;
7458cd7
  	    if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent)
7458cd7
  								      == FAIL)
7458cd7
--- 1227,1238 ----
7458cd7
  		if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, silent) == FAIL)
7458cd7
  		    return FAIL;
7458cd7
  	    }
7458cd7
! 	    escaped = vim_strsave_escape_csi(y_current->y_array[i]);
7458cd7
! 	    if (escaped == NULL)
7458cd7
! 		return FAIL;
7458cd7
! 	    retval = ins_typebuf(escaped, remap, 0, TRUE, silent);
7458cd7
! 	    vim_free(escaped);
7458cd7
! 	    if (retval == FAIL)
7458cd7
  		return FAIL;
7458cd7
  	    if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent)
7458cd7
  								      == FAIL)
7458cd7
***************
7458cd7
*** 1265,1272 ****
7458cd7
  }
7458cd7
  
7458cd7
      static int
7458cd7
! put_in_typebuf(s, colon, silent)
7458cd7
      char_u	*s;
7458cd7
      int		colon;	    /* add ':' before the line */
7458cd7
      int		silent;
7458cd7
  {
7458cd7
--- 1272,1280 ----
7458cd7
  }
7458cd7
  
7458cd7
      static int
7458cd7
! put_in_typebuf(s, esc, colon, silent)
7458cd7
      char_u	*s;
7458cd7
+     int		esc;	    /* Escape CSI characters */
7458cd7
      int		colon;	    /* add ':' before the line */
7458cd7
      int		silent;
7458cd7
  {
7458cd7
***************
7458cd7
*** 1276,1282 ****
7458cd7
      if (colon)
7458cd7
  	retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent);
7458cd7
      if (retval == OK)
7458cd7
! 	retval = ins_typebuf(s, REMAP_YES, 0, TRUE, silent);
7458cd7
      if (colon && retval == OK)
7458cd7
  	retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, silent);
7458cd7
      return retval;
7458cd7
--- 1284,1303 ----
7458cd7
      if (colon)
7458cd7
  	retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent);
7458cd7
      if (retval == OK)
7458cd7
!     {
7458cd7
! 	char_u	*p;
7458cd7
! 
7458cd7
! 	if (esc)
7458cd7
! 	    p = vim_strsave_escape_csi(s);
7458cd7
! 	else
7458cd7
! 	    p = s;
7458cd7
! 	if (p == NULL)
7458cd7
! 	    retval = FAIL;
7458cd7
! 	else
7458cd7
! 	    retval = ins_typebuf(p, REMAP_YES, 0, TRUE, silent);
7458cd7
! 	if (esc)
7458cd7
! 	    vim_free(p);
7458cd7
!     }
7458cd7
      if (colon && retval == OK)
7458cd7
  	retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, silent);
7458cd7
      return retval;
7458cd7
*** ../vim-7.0.202/src/version.c	Tue Feb 27 16:51:07 2007
7458cd7
--- src/version.c	Tue Feb 27 17:22:13 2007
7458cd7
***************
7458cd7
*** 668,669 ****
7458cd7
--- 668,671 ----
7458cd7
  {   /* Add new patch number below this line */
7458cd7
+ /**/
7458cd7
+     203,
7458cd7
  /**/
7458cd7
7458cd7
-- 
7458cd7
hundred-and-one symptoms of being an internet addict:
7458cd7
215. Your mouse-clicking forearm rivals Popeye's.
7458cd7
7458cd7
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
7458cd7
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
7458cd7
\\\        download, build and distribute -- http://www.A-A-P.org        ///
7458cd7
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///