summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-09-20 15:19:06 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-09-20 15:19:06 +0000
commit33c9432d56cbb454ecd48335af22053aca2416bc (patch)
tree2708702229624253658c74a9007c09ff5480a402
parent409296e22fb1cef515ccfff507c265a5fee0ab28 (diff)
downloadzsh-33c9432d56cbb454ecd48335af22053aca2416bc.tar.gz
zsh-33c9432d56cbb454ecd48335af22053aca2416bc.tar.xz
zsh-33c9432d56cbb454ecd48335af22053aca2416bc.zip
21737: unmetafy wordchars before looking for multibyte characters
-rw-r--r--ChangeLog3
-rw-r--r--Src/utils.c13
2 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 1052e53ee..745f1e3da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-09-20  Peter Stephenson  <pws@csr.com>
 
+	* 21737: Src/utils.c: unmetafy wordchars before looking for
+	mulitbyte characters.
+
 	* 21736: Src/init.c, Src/params.c, Src/pattern.c, Src/utils.c,
 	Src/Zle/zle.h, Src/Zle/zle_main.c: Fix WORDCHARS to use multibyte
 	characters; rationalise test for identifiers only to use ASCII
diff --git a/Src/utils.c b/Src/utils.c
index dce10beee..561624f51 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2499,15 +2499,18 @@ inittyptab(void)
     }
 #ifdef ZLE_UNICODE_SUPPORT
     if (wordchars) {
-	const char *wordchars_ptr = wordchars;
+	char *wordchars_unmeta;
+	const char *wordchars_ptr;
 	mbstate_t mbs;
-	int nchars;
+	int nchars, unmetalen;
+
+	wordchars_unmeta = dupstring(wordchars);
+	wordchars_ptr = unmetafy(wordchars_unmeta, &unmetalen);
 
 	memset(&mbs, 0, sizeof(mbs));
 	wordchars_wide = (wchar_t *)
-	    zrealloc(wordchars_wide, (strlen(wordchars)+1)*sizeof(wchar_t));
-	nchars = mbsrtowcs(wordchars_wide, &wordchars_ptr, strlen(wordchars),
-			   &mbs);
+	    zrealloc(wordchars_wide, (unmetalen+1)*sizeof(wchar_t));
+	nchars = mbsrtowcs(wordchars_wide, &wordchars_ptr, unmetalen, &mbs);
 	if (nchars == -1) {
 	    /* Conversion state is undefined: better just set to null */
 	    *wordchars_wide = L'\0';