<f-args> breaks multi-byte character where the second byte is 0x5c when
using DBCS encoding.
Steps to reproduce:
:set encoding=cp932
:command -nargs=* Test :echo [<f-args>]
:execute "Test \u955c a b c" (0x955c in cp932 is U+8868 in Unicode)
Then, first argument is displayed as broken.
The following patch fixes this problem.
Please check it.
diff -r 8247c65112b0 src/ex_docmd.c
--- a/src/ex_docmd.c Tue Jul 10 13:41:14 2012 +0200
+++ b/src/ex_docmd.c Tue Jul 10 21:52:22 2012 +0900
@@ -5814,6 +5814,7 @@
char_u *p;
char_u *q;
int len;
+ int charlen;
/* Precalculate length */
p = arg;
@@ -5845,8 +5846,9 @@
}
else
{
- ++len;
- ++p;
+ charlen = mb_cptr2len(p);
+ len += charlen;
+ p += charlen;
}
}
@@ -5889,7 +5891,7 @@
}
else
{
- *q++ = *p++;
+ MB_COPY_CHAR(p, q);
}
}
*q++ = '"';
--
Yukihiro Nakadaira - [email protected]
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php