From 732d503396dcd3a186376b9728bf86de4154f9e3 Mon Sep 17 00:00:00 2001 From: taynpg Date: Tue, 18 Feb 2025 04:57:33 +0800 Subject: [PATCH] =?UTF-8?q?apro=EF=BC=9A=E5=B0=9D=E8=AF=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96linux=E4=B8=8B=E5=88=B7=E6=96=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- filecomplete.cpp | 9 +++++---- main.cpp | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/filecomplete.cpp b/filecomplete.cpp index 0e842e9..9fdfd1e 100644 --- a/filecomplete.cpp +++ b/filecomplete.cpp @@ -411,6 +411,8 @@ void set_cursor_x(short x) } #elif defined(OS_UNIX) printf("\033[%d;%dH", get_cursor_y(), x); + fc_enable_cur(); + fflush(stdout); #endif fc_unlock_print(); } @@ -574,7 +576,8 @@ char* fc_readline() } } #endif - set_cursor_x(cur_pos + 1 + header_len); + auto ccc = cur_pos + 1 + header_len; + set_cursor_x(ccc); }; while (1) { @@ -831,9 +834,7 @@ void color_print(const char* text, const COLOR_TYPE color) } else { printf("%s", text); } - // Resets the text to default color - printf("\033[0m"); - fflush(stdout); + fc_disable_cur(); #endif fc_unlock_print(); } diff --git a/main.cpp b/main.cpp index fc34d68..0a381ab 100644 --- a/main.cpp +++ b/main.cpp @@ -30,6 +30,9 @@ int main(int argc, char** argv) std::cout << "" << std::endl; std::cout << cmd_input << std::endl; } + else { + break; + } } // t.join();