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