fix:修正回车确认后残留提示的信息。

This commit is contained in:
taynpg 2025-01-21 13:11:37 +08:00
parent fcd61b381a
commit cca1e149cd

View File

@ -509,7 +509,7 @@ char* fc_readline()
SetConsoleCursorInfo(hConsole, &cursorInfo); SetConsoleCursorInfo(hConsole, &cursorInfo);
#endif #endif
while (1) { auto refresh_show = [&]() {
word.clear(); word.clear();
clear_line(); clear_line();
// Print current buffer // Print current buffer
@ -533,6 +533,11 @@ char* fc_readline()
} }
#endif #endif
set_cursor_x(cur_pos + 1); set_cursor_x(cur_pos + 1);
};
while (1) {
refresh_show();
need_predic = true; need_predic = true;
// Read character from console // Read character from console
@ -555,6 +560,9 @@ char* fc_readline()
cursorInfo.bVisible = FALSE; cursorInfo.bVisible = FALSE;
SetConsoleCursorInfo(hConsole, &cursorInfo); SetConsoleCursorInfo(hConsole, &cursorInfo);
#endif #endif
// 这里还需要清除预测显示
str_predict.clear();
refresh_show();
append_his(main_buf); append_his(main_buf);
return main_buf; return main_buf;
#if defined(OS_WINDOWS) #if defined(OS_WINDOWS)