fix:尝试处理win下回车后可能导致的残留光标显示问题。
This commit is contained in:
parent
27241c505b
commit
fcd61b381a
@ -501,6 +501,14 @@ char* fc_readline()
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> p1, p2;
|
||||
p1 = std::chrono::high_resolution_clock::now();
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
CONSOLE_CURSOR_INFO cursorInfo;
|
||||
GetConsoleCursorInfo(hConsole, &cursorInfo);
|
||||
cursorInfo.bVisible = TRUE;
|
||||
SetConsoleCursorInfo(hConsole, &cursorInfo);
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
word.clear();
|
||||
clear_line();
|
||||
@ -540,6 +548,13 @@ char* fc_readline()
|
||||
|
||||
switch (ch) {
|
||||
case ENTER:
|
||||
#if defined(OS_WINDOWS)
|
||||
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
CONSOLE_CURSOR_INFO cursorInfo;
|
||||
GetConsoleCursorInfo(hConsole, &cursorInfo);
|
||||
cursorInfo.bVisible = FALSE;
|
||||
SetConsoleCursorInfo(hConsole, &cursorInfo);
|
||||
#endif
|
||||
append_his(main_buf);
|
||||
return main_buf;
|
||||
#if defined(OS_WINDOWS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user