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