diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2016-10-23 21:32:58 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2016-10-23 21:32:58 +0100 |
commit | 6f071b2309283bfe0798bd317f79622cc22270e0 (patch) | |
tree | 4783ab561deff3bb026ac9cd5cdbb52519f41fa2 /Src | |
parent | 8e3e72793363a7d209af9c6a98b992e76aecc6c3 (diff) | |
download | zsh-6f071b2309283bfe0798bd317f79622cc22270e0.tar.gz zsh-6f071b2309283bfe0798bd317f79622cc22270e0.tar.xz zsh-6f071b2309283bfe0798bd317f79622cc22270e0.zip |
39715: Handle multibyte characters in complist listing
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/complist.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index 8aeb6c3b8..39ac782eb 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -662,7 +662,9 @@ clprintfmt(char *p, int ml) initiscol(); - for (; *p; p++) { + while (*p) { + convchar_t chr; + int chrlen = MB_METACHARLENCONV(p, &chr); doiscol(i++); cc++; if (*p == '\n') { @@ -673,11 +675,16 @@ clprintfmt(char *p, int ml) if (ml == mlend - 1 && (cc % zterm_columns) == zterm_columns - 1) return 0; - if (*p == Meta) { + while (chrlen) { + if (*p == Meta) { + p++; + chrlen--; + putc(*p ^ 32, shout); + } else + putc(*p, shout); + chrlen--; p++; - putc(*p ^ 32, shout); - } else - putc(*p, shout); + } if ((beg = !(cc % zterm_columns))) ml++; if (mscroll && !(cc % zterm_columns) && |