提交 286984f3 编写于 作者: A Alex Duan

feat(shell): autotab show on screen reset to old

上级 82337317
......@@ -79,11 +79,8 @@ void insertChar(Command *cmd, char *c, int size) {
/* update the values */
cmd->commandSize += size;
cmd->cursorOffset += size;
for (int i = 0; i < size; i++) {
mbtowc(&wc, c + i, size);
cmd->screenOffset += wcwidth(wc);
cmd->endOffset += wcwidth(wc);
}
showOnScreen(cmd);
}
......
......@@ -539,14 +539,14 @@ void showOnScreen(Command *cmd) {
/* assert(size >= 0); */
int width = wcwidth(wc);
if (remain_column > width) {
fprintf(stdout, "%lc", wc);
printf("%lc", wc);
remain_column -= width;
} else {
if (remain_column == width) {
fprintf(stdout, "%lc\n\r", wc);
printf("%lc\n\r", wc);
remain_column = w.ws_col;
} else {
fprintf(stdout, "\n\r%lc", wc);
printf("\n\r%lc", wc);
remain_column = w.ws_col - width;
}
}
......
......@@ -568,14 +568,14 @@ void showOnScreen(Command *cmd) {
/* assert(size >= 0); */
int width = wcwidth(wc);
if (remain_column > width) {
fprintf(stdout, "%lc", wc);
printf("%lc", wc);
remain_column -= width;
} else {
if (remain_column == width) {
fprintf(stdout, "%lc\n\r", wc);
printf("%lc\n\r", wc);
remain_column = w.ws_col;
} else {
fprintf(stdout, "\n\r%lc", wc);
printf("\n\r%lc", wc);
remain_column = w.ws_col - width;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册