Karsten Hopp 32f783
To: vim_dev@googlegroups.com
Karsten Hopp 32f783
Subject: Patch 7.3.419
Karsten Hopp 32f783
Fcc: outbox
Karsten Hopp 32f783
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 32f783
Mime-Version: 1.0
Karsten Hopp 32f783
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 32f783
Content-Transfer-Encoding: 8bit
Karsten Hopp 32f783
------------
Karsten Hopp 32f783
Karsten Hopp 32f783
Patch 7.3.419
Karsten Hopp 32f783
Problem:    DBCS encoding in a user command does not always work.
Karsten Hopp 32f783
Solution:   Skip over DBCS characters. (Yasuhiro Matsumoto)
Karsten Hopp 32f783
Files:	    src/ex_docmd.c
Karsten Hopp 32f783
Karsten Hopp 32f783
Karsten Hopp 32f783
*** ../vim-7.3.418/src/ex_docmd.c	2011-12-14 14:49:41.000000000 +0100
Karsten Hopp 32f783
--- src/ex_docmd.c	2012-01-26 20:04:01.000000000 +0100
Karsten Hopp 32f783
***************
Karsten Hopp 32f783
*** 5967,5973 ****
Karsten Hopp 32f783
  	    result = STRLEN(eap->arg) + 2;
Karsten Hopp 32f783
  	    for (p = eap->arg; *p; ++p)
Karsten Hopp 32f783
  	    {
Karsten Hopp 32f783
! 		if (*p == '\\' || *p == '"')
Karsten Hopp 32f783
  		    ++result;
Karsten Hopp 32f783
  	    }
Karsten Hopp 32f783
  
Karsten Hopp 32f783
--- 5967,5980 ----
Karsten Hopp 32f783
  	    result = STRLEN(eap->arg) + 2;
Karsten Hopp 32f783
  	    for (p = eap->arg; *p; ++p)
Karsten Hopp 32f783
  	    {
Karsten Hopp 32f783
! #ifdef  FEAT_MBYTE
Karsten Hopp 32f783
! 		if (enc_dbcs != 0 && (*mb_ptr2len)(p) == 2)
Karsten Hopp 32f783
! 		    /* DBCS can contain \ in a trail byte, skip the
Karsten Hopp 32f783
! 		     * double-byte character. */
Karsten Hopp 32f783
! 		    ++p;
Karsten Hopp 32f783
! 		else
Karsten Hopp 32f783
! #endif
Karsten Hopp 32f783
! 		     if (*p == '\\' || *p == '"')
Karsten Hopp 32f783
  		    ++result;
Karsten Hopp 32f783
  	    }
Karsten Hopp 32f783
  
Karsten Hopp 32f783
***************
Karsten Hopp 32f783
*** 5976,5982 ****
Karsten Hopp 32f783
  		*buf++ = '"';
Karsten Hopp 32f783
  		for (p = eap->arg; *p; ++p)
Karsten Hopp 32f783
  		{
Karsten Hopp 32f783
! 		    if (*p == '\\' || *p == '"')
Karsten Hopp 32f783
  			*buf++ = '\\';
Karsten Hopp 32f783
  		    *buf++ = *p;
Karsten Hopp 32f783
  		}
Karsten Hopp 32f783
--- 5983,5996 ----
Karsten Hopp 32f783
  		*buf++ = '"';
Karsten Hopp 32f783
  		for (p = eap->arg; *p; ++p)
Karsten Hopp 32f783
  		{
Karsten Hopp 32f783
! #ifdef  FEAT_MBYTE
Karsten Hopp 32f783
! 		    if (enc_dbcs != 0 && (*mb_ptr2len)(p) == 2)
Karsten Hopp 32f783
! 			/* DBCS can contain \ in a trail byte, copy the
Karsten Hopp 32f783
! 			 * double-byte character to avoid escaping. */
Karsten Hopp 32f783
! 			*buf++ = *p++;
Karsten Hopp 32f783
! 		    else
Karsten Hopp 32f783
! #endif
Karsten Hopp 32f783
! 			 if (*p == '\\' || *p == '"')
Karsten Hopp 32f783
  			*buf++ = '\\';
Karsten Hopp 32f783
  		    *buf++ = *p;
Karsten Hopp 32f783
  		}
Karsten Hopp 32f783
*** ../vim-7.3.418/src/version.c	2012-01-26 18:58:25.000000000 +0100
Karsten Hopp 32f783
--- src/version.c	2012-01-26 20:40:34.000000000 +0100
Karsten Hopp 32f783
***************
Karsten Hopp 32f783
*** 716,717 ****
Karsten Hopp 32f783
--- 716,719 ----
Karsten Hopp 32f783
  {   /* Add new patch number below this line */
Karsten Hopp 32f783
+ /**/
Karsten Hopp 32f783
+     419,
Karsten Hopp 32f783
  /**/
Karsten Hopp 32f783
Karsten Hopp 32f783
-- 
Karsten Hopp 32f783
You have heard the saying that if you put a thousand monkeys in a room with a
Karsten Hopp 32f783
thousand typewriters and waited long enough, eventually you would have a room
Karsten Hopp 32f783
full of dead monkeys.
Karsten Hopp 32f783
				(Scott Adams - The Dilbert principle)
Karsten Hopp 32f783
Karsten Hopp 32f783
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 32f783
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 32f783
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 32f783
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///