From 48069ca974cc50832fa326289e0bc1235e6d0fd9 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 19 Oct 2022 20:14:30 +0800 Subject: [PATCH] fix(shell): restore zhiqiang modify chinese char show modifing --- tools/shell/src/shellCommand.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/shell/src/shellCommand.c b/tools/shell/src/shellCommand.c index 665c832b85..047aeb5b95 100644 --- a/tools/shell/src/shellCommand.c +++ b/tools/shell/src/shellCommand.c @@ -101,8 +101,11 @@ void shellInsertChar(SShellCmd *cmd, char *c, int32_t size) { /* update the values */ cmd->commandSize += size; cmd->cursorOffset += size; - cmd->screenOffset += taosWcharWidth(wc); - cmd->endOffset += taosWcharWidth(wc); + for (int i = 0; i < size; i++) { + taosMbToWchar(&wc, c + i, size); + cmd->screenOffset += taosWcharWidth(wc); + cmd->endOffset += taosWcharWidth(wc); + } // set string end cmd->command[cmd->commandSize] = 0; #ifdef WINDOWS