From cd7e59cfc81a40290bff4b224b84e9a8ac977707 Mon Sep 17 00:00:00 2001 From: slguan Date: Thu, 12 Sep 2019 15:25:52 +0800 Subject: [PATCH] fix issue #503 --- src/kit/shell/src/shellLinux.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/kit/shell/src/shellLinux.c b/src/kit/shell/src/shellLinux.c index 84437389ef..7190070238 100644 --- a/src/kit/shell/src/shellLinux.c +++ b/src/kit/shell/src/shellLinux.c @@ -312,7 +312,12 @@ void shellPrintNChar(char *str, int width, bool printMode) { if (*str == '\0') break; char *tstr = str; int byte_width = mbtowc(&wc, tstr, MB_CUR_MAX); + if (byte_width <= 0 ) break; int col_width = wcwidth(wc); + if (col_width <= 0) { + str += byte_width; + continue; + } if (col_left < col_width) break; printf("%lc", wc); str += byte_width; -- GitLab