Blob Blame History Raw
To: vim-dev@vim.org
Subject: patch 7.0.207
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.207
Problem:    After patch 2.0.203 CSI and K_SPECIAL characters are escaped when
	    recorded and then again when the register is executed.
Solution:   Remove escaping before putting the recorded characters in a
	    register.  (Yukihiro Nakadaira)
Files:	    src/getchar.c, src/ops.c, src/proto/getchar.pro


*** ../vim-7.0.206/src/getchar.c	Tue Feb 27 23:06:44 2007
--- src/getchar.c	Sun Mar  4 21:19:50 2007
***************
*** 4438,4443 ****
--- 4442,4476 ----
  	*d = NUL;
      }
      return res;
+ }
+ 
+ /*
+  * Remove escaping from CSI and K_SPECIAL characters.  Reverse of
+  * vim_strsave_escape_csi().  Works in-place.
+  */
+     void
+ vim_unescape_csi(p)
+     char_u *p;
+ {
+     char_u	*s = p, *d = p;
+ 
+     while (*s != NUL)
+     {
+ 	if (s[0] == K_SPECIAL && s[1] == KS_SPECIAL && s[2] == KE_FILLER)
+ 	{
+ 	    *d++ = K_SPECIAL;
+ 	    s += 3;
+ 	}
+ 	else if ((s[0] == K_SPECIAL || s[0] == CSI)
+ 				   && s[1] == KS_EXTRA && s[2] == (int)KE_CSI)
+ 	{
+ 	    *d++ = CSI;
+ 	    s += 3;
+ 	}
+ 	else
+ 	    *d++ = *s++;
+     }
+     *d = NUL;
  }
  
  /*
*** ../vim-7.0.206/src/ops.c	Tue Feb 27 17:25:28 2007
--- src/ops.c	Sun Mar  4 21:23:47 2007
***************
*** 1042,1047 ****
--- 1042,1050 ----
  	    retval = FAIL;
  	else
  	{
+ 	    /* Remove escaping for CSI and K_SPECIAL in multi-byte chars. */
+ 	    vim_unescape_csi(p);
+ 
  	    /*
  	     * We don't want to change the default register here, so save and
  	     * restore the current register name.
*** ../vim-7.0.206/src/proto/getchar.pro	Sun Apr 30 20:38:15 2006
--- src/proto/getchar.pro	Sun Mar  4 21:19:41 2007
***************
*** 56,61 ****
--- 56,62 ----
  extern int ExpandMappings __ARGS((regmatch_T *regmatch, int *num_file, char_u ***file));
  extern int check_abbr __ARGS((int c, char_u *ptr, int col, int mincol));
  extern char_u *vim_strsave_escape_csi __ARGS((char_u *p));
+ extern void vim_unescape_csi __ARGS((char_u *p));
  extern int makemap __ARGS((FILE *fd, buf_T *buf));
  extern int put_escstr __ARGS((FILE *fd, char_u *strstart, int what));
  extern void check_map_keycodes __ARGS((void));
*** ../vim-7.0.206/src/version.c	Fri Mar  2 20:00:06 2007
--- src/version.c	Sun Mar  4 21:24:26 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     207,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
251. You've never seen your closest friends who usually live WAY too far away.

 /// 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    ///