diff options
author | Peter Stephenson <pws@zsh.org> | 2015-06-12 09:30:39 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2015-06-12 09:30:39 +0100 |
commit | f1923bdfa6300a0d32e3329eb2488447f76b8970 (patch) | |
tree | eed76e87f3e28384f5597030978d802265715a14 /Src/zsh.h | |
parent | 370e7f73f68af06aaf1595bc8b16ec7e8c910409 (diff) | |
download | zsh-f1923bdfa6300a0d32e3329eb2488447f76b8970.tar.gz zsh-f1923bdfa6300a0d32e3329eb2488447f76b8970.tar.xz zsh-f1923bdfa6300a0d32e3329eb2488447f76b8970.zip |
Add non-metafied character length handling.
Use this in regex module and add test using $'\ua0'. Rename mb_metacharinit() to mb_charinit() as it does not involve metafied characters.
Diffstat (limited to 'Src/zsh.h')
-rw-r--r-- | Src/zsh.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Src/zsh.h b/Src/zsh.h index c88c2e739..fb04929d9 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -2921,8 +2921,9 @@ enum { #define AFTERTRAPHOOK (zshhooks + 2) #ifdef MULTIBYTE_SUPPORT +/* Metafied input */ #define nicezputs(str, outs) (void)mb_niceformat((str), (outs), NULL, 0) -#define MB_METACHARINIT() mb_metacharinit() +#define MB_METACHARINIT() mb_charinit() typedef wint_t convchar_t; #define MB_METACHARLENCONV(str, cp) mb_metacharlenconv((str), (cp)) #define MB_METACHARLEN(str) mb_metacharlenconv(str, NULL) @@ -2932,6 +2933,11 @@ typedef wint_t convchar_t; #define MB_METASTRLEN2END(str, widthp, eptr) \ mb_metastrlenend(str, widthp, eptr) +/* Unmetafined input */ +#define MB_CHARINIT() mb_charinit() +#define MB_CHARLENCONV(str, len, cp) mb_charlenconv((str), (len), (cp)) +#define MB_CHARLEN(str, len) mb_charlenconv((str), (len), NULL) + /* * We replace broken implementations with one that uses Unicode * characters directly as wide characters. In principle this is only @@ -3015,6 +3021,10 @@ typedef int convchar_t; #define MB_METASTRLEN2(str, widthp) ztrlen(str) #define MB_METASTRLEN2END(str, widthp, eptr) ztrlenend(str, eptr) +#define MB_CHARINIT() +#define MB_CHARLENCONV(str, len, cp) charlenconv((str), (len), (cp)) +#define MB_CHARLEN(str, len) ((len) ? 1 : 0) + #define WCWIDTH_WINT(c) (1) /* Leave character or string as is. */ |