From 58fa3dbb09b41538192ae0c8ecf73dc8245a225a Mon Sep 17 00:00:00 2001
From: taynpg <taynpg@163.com>
Date: Sat, 8 Feb 2025 08:24:04 +0800
Subject: [PATCH] =?UTF-8?q?try=EF=BC=9A=E5=B0=9D=E8=AF=95=E4=BF=AE?=
 =?UTF-8?q?=E6=AD=A3Linux=E4=B8=8B=E5=81=B6=E5=8F=91=E5=85=89=E6=A0=87?=
 =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E4=B8=8D=E6=AD=A3=E7=A1=AE=E9=97=AE=E9=A2=98?=
 =?UTF-8?q?=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 CMakeLists.txt   |  1 -
 filecomplete.cpp | 11 +++++++----
 main.cpp         |  4 ++--
 3 files changed, 9 insertions(+), 7 deletions(-)

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 <string>
 #include <thread>
 
-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;
     }
 }