From cca1e149cd2a3f2e54524af786e2137ef4a946b2 Mon Sep 17 00:00:00 2001 From: taynpg Date: Tue, 21 Jan 2025 13:11:37 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=AD=A3=E5=9B=9E?= =?UTF-8?q?=E8=BD=A6=E7=A1=AE=E8=AE=A4=E5=90=8E=E6=AE=8B=E7=95=99=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- filecomplete.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/filecomplete.cpp b/filecomplete.cpp index 0b2bf80..a865694 100644 --- a/filecomplete.cpp +++ b/filecomplete.cpp @@ -509,7 +509,7 @@ char* fc_readline() SetConsoleCursorInfo(hConsole, &cursorInfo); #endif - while (1) { + auto refresh_show = [&]() { word.clear(); clear_line(); // Print current buffer @@ -533,6 +533,11 @@ char* fc_readline() } #endif set_cursor_x(cur_pos + 1); + }; + + while (1) { + + refresh_show(); need_predic = true; // Read character from console @@ -555,6 +560,9 @@ char* fc_readline() cursorInfo.bVisible = FALSE; SetConsoleCursorInfo(hConsole, &cursorInfo); #endif + // 这里还需要清除预测显示 + str_predict.clear(); + refresh_show(); append_his(main_buf); return main_buf; #if defined(OS_WINDOWS)