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)