This commit is contained in:
slguan 2019-09-12 15:25:52 +08:00
parent 2c800e3ccc
commit cd7e59cfc8
1 changed files with 5 additions and 0 deletions

View File

@ -312,7 +312,12 @@ void shellPrintNChar(char *str, int width, bool printMode) {
if (*str == '\0') break; if (*str == '\0') break;
char *tstr = str; char *tstr = str;
int byte_width = mbtowc(&wc, tstr, MB_CUR_MAX); int byte_width = mbtowc(&wc, tstr, MB_CUR_MAX);
if (byte_width <= 0 ) break;
int col_width = wcwidth(wc); int col_width = wcwidth(wc);
if (col_width <= 0) {
str += byte_width;
continue;
}
if (col_left < col_width) break; if (col_left < col_width) break;
printf("%lc", wc); printf("%lc", wc);
str += byte_width; str += byte_width;