diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2005-09-20 15:19:06 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2005-09-20 15:19:06 +0000 |
commit | 33c9432d56cbb454ecd48335af22053aca2416bc (patch) | |
tree | 2708702229624253658c74a9007c09ff5480a402 /Src | |
parent | 409296e22fb1cef515ccfff507c265a5fee0ab28 (diff) | |
download | zsh-33c9432d56cbb454ecd48335af22053aca2416bc.tar.gz zsh-33c9432d56cbb454ecd48335af22053aca2416bc.tar.xz zsh-33c9432d56cbb454ecd48335af22053aca2416bc.zip |
21737: unmetafy wordchars before looking for multibyte characters
Diffstat (limited to 'Src')
-rw-r--r-- | Src/utils.c | 13 |
1 files changed, 8 insertions, 5 deletions
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'; |