From 6f071b2309283bfe0798bd317f79622cc22270e0 Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Sun, 23 Oct 2016 21:32:58 +0100
Subject: 39715: Handle multibyte characters in complist listing
---
Src/Zle/complist.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
(limited to 'Src/Zle')
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) &&
--
cgit 1.4.1