diff --git a/CMakeLists.txt b/CMakeLists.txt index a22167d..59f93b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ endif() if(DEFINED IOS_ISH) message(STATUS "filecomplete USE IOS_ISH") add_definitions(-DIOS_ISH) - add_definitions(-DMFLUSH_STDOUT) endif() if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") diff --git a/filecomplete.cpp b/filecomplete.cpp index a865694..3274e10 100644 --- a/filecomplete.cpp +++ b/filecomplete.cpp @@ -531,13 +531,19 @@ char* fc_readline() cur_pos += 1; } } +#endif +#if defined(OS_UNIX) + fflush(stdout); #endif set_cursor_x(cur_pos + 1); +#if defined(OS_UNIX) + fflush(stdout); +#endif }; while (1) { - refresh_show(); + refresh_show(); need_predic = true; // Read character from console @@ -748,8 +754,5 @@ void color_print(const char* text, const COLOR_TYPE color) } // Resets the text to default color printf("\033[0m"); -#if defined(MFLUSH_STDOUT) - fflush(stdout); -#endif #endif } diff --git a/main.cpp b/main.cpp index ecfef96..a6b1781 100644 --- a/main.cpp +++ b/main.cpp @@ -3,13 +3,13 @@ #include #include -static int cnt = 5; +static int cnt = 500; // 测试光标位置 void delay_auto_show() { while (--cnt) { - std::this_thread::sleep_for(std::chrono::seconds(10)); + std::this_thread::sleep_for(std::chrono::seconds(1)); std::cout << "IMCOMMING..............." << std::endl; } }