Karsten Hopp 0af16e
To: vim-dev@vim.org
Karsten Hopp 0af16e
Subject: patch 7.0.207
Karsten Hopp 0af16e
Fcc: outbox
Karsten Hopp 0af16e
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 0af16e
Mime-Version: 1.0
Karsten Hopp 0af16e
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 0af16e
Content-Transfer-Encoding: 8bit
Karsten Hopp 0af16e
------------
Karsten Hopp 0af16e
Karsten Hopp 0af16e
Patch 7.0.207
Karsten Hopp 0af16e
Problem:    After patch 2.0.203 CSI and K_SPECIAL characters are escaped when
Karsten Hopp 0af16e
	    recorded and then again when the register is executed.
Karsten Hopp 0af16e
Solution:   Remove escaping before putting the recorded characters in a
Karsten Hopp 0af16e
	    register.  (Yukihiro Nakadaira)
Karsten Hopp 0af16e
Files:	    src/getchar.c, src/ops.c, src/proto/getchar.pro
Karsten Hopp 0af16e
Karsten Hopp 0af16e
Karsten Hopp 0af16e
*** ../vim-7.0.206/src/getchar.c	Tue Feb 27 23:06:44 2007
Karsten Hopp 0af16e
--- src/getchar.c	Sun Mar  4 21:19:50 2007
Karsten Hopp 0af16e
***************
Karsten Hopp 0af16e
*** 4438,4443 ****
Karsten Hopp 0af16e
--- 4442,4476 ----
Karsten Hopp 0af16e
  	*d = NUL;
Karsten Hopp 0af16e
      }
Karsten Hopp 0af16e
      return res;
Karsten Hopp 0af16e
+ }
Karsten Hopp 0af16e
+ 
Karsten Hopp 0af16e
+ /*
Karsten Hopp 0af16e
+  * Remove escaping from CSI and K_SPECIAL characters.  Reverse of
Karsten Hopp 0af16e
+  * vim_strsave_escape_csi().  Works in-place.
Karsten Hopp 0af16e
+  */
Karsten Hopp 0af16e
+     void
Karsten Hopp 0af16e
+ vim_unescape_csi(p)
Karsten Hopp 0af16e
+     char_u *p;
Karsten Hopp 0af16e
+ {
Karsten Hopp 0af16e
+     char_u	*s = p, *d = p;
Karsten Hopp 0af16e
+ 
Karsten Hopp 0af16e
+     while (*s != NUL)
Karsten Hopp 0af16e
+     {
Karsten Hopp 0af16e
+ 	if (s[0] == K_SPECIAL && s[1] == KS_SPECIAL && s[2] == KE_FILLER)
Karsten Hopp 0af16e
+ 	{
Karsten Hopp 0af16e
+ 	    *d++ = K_SPECIAL;
Karsten Hopp 0af16e
+ 	    s += 3;
Karsten Hopp 0af16e
+ 	}
Karsten Hopp 0af16e
+ 	else if ((s[0] == K_SPECIAL || s[0] == CSI)
Karsten Hopp 0af16e
+ 				   && s[1] == KS_EXTRA && s[2] == (int)KE_CSI)
Karsten Hopp 0af16e
+ 	{
Karsten Hopp 0af16e
+ 	    *d++ = CSI;
Karsten Hopp 0af16e
+ 	    s += 3;
Karsten Hopp 0af16e
+ 	}
Karsten Hopp 0af16e
+ 	else
Karsten Hopp 0af16e
+ 	    *d++ = *s++;
Karsten Hopp 0af16e
+     }
Karsten Hopp 0af16e
+     *d = NUL;
Karsten Hopp 0af16e
  }
Karsten Hopp 0af16e
  
Karsten Hopp 0af16e
  /*
Karsten Hopp 0af16e
*** ../vim-7.0.206/src/ops.c	Tue Feb 27 17:25:28 2007
Karsten Hopp 0af16e
--- src/ops.c	Sun Mar  4 21:23:47 2007
Karsten Hopp 0af16e
***************
Karsten Hopp 0af16e
*** 1042,1047 ****
Karsten Hopp 0af16e
--- 1042,1050 ----
Karsten Hopp 0af16e
  	    retval = FAIL;
Karsten Hopp 0af16e
  	else
Karsten Hopp 0af16e
  	{
Karsten Hopp 0af16e
+ 	    /* Remove escaping for CSI and K_SPECIAL in multi-byte chars. */
Karsten Hopp 0af16e
+ 	    vim_unescape_csi(p);
Karsten Hopp 0af16e
+ 
Karsten Hopp 0af16e
  	    /*
Karsten Hopp 0af16e
  	     * We don't want to change the default register here, so save and
Karsten Hopp 0af16e
  	     * restore the current register name.
Karsten Hopp 0af16e
*** ../vim-7.0.206/src/proto/getchar.pro	Sun Apr 30 20:38:15 2006
Karsten Hopp 0af16e
--- src/proto/getchar.pro	Sun Mar  4 21:19:41 2007
Karsten Hopp 0af16e
***************
Karsten Hopp 0af16e
*** 56,61 ****
Karsten Hopp 0af16e
--- 56,62 ----
Karsten Hopp 0af16e
  extern int ExpandMappings __ARGS((regmatch_T *regmatch, int *num_file, char_u ***file));
Karsten Hopp 0af16e
  extern int check_abbr __ARGS((int c, char_u *ptr, int col, int mincol));
Karsten Hopp 0af16e
  extern char_u *vim_strsave_escape_csi __ARGS((char_u *p));
Karsten Hopp 0af16e
+ extern void vim_unescape_csi __ARGS((char_u *p));
Karsten Hopp 0af16e
  extern int makemap __ARGS((FILE *fd, buf_T *buf));
Karsten Hopp 0af16e
  extern int put_escstr __ARGS((FILE *fd, char_u *strstart, int what));
Karsten Hopp 0af16e
  extern void check_map_keycodes __ARGS((void));
Karsten Hopp 0af16e
*** ../vim-7.0.206/src/version.c	Fri Mar  2 20:00:06 2007
Karsten Hopp 0af16e
--- src/version.c	Sun Mar  4 21:24:26 2007
Karsten Hopp 0af16e
***************
Karsten Hopp 0af16e
*** 668,669 ****
Karsten Hopp 0af16e
--- 668,671 ----
Karsten Hopp 0af16e
  {   /* Add new patch number below this line */
Karsten Hopp 0af16e
+ /**/
Karsten Hopp 0af16e
+     207,
Karsten Hopp 0af16e
  /**/
Karsten Hopp 0af16e
Karsten Hopp 0af16e
-- 
Karsten Hopp 0af16e
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 0af16e
251. You've never seen your closest friends who usually live WAY too far away.
Karsten Hopp 0af16e
Karsten Hopp 0af16e
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 0af16e
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 0af16e
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 0af16e
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///