From 45818b1ebacf5ec4555f93ae7cda97f202facc11 Mon Sep 17 00:00:00 2001 From: martin legrand Date: Sat, 29 Mar 2025 20:12:18 +0100 Subject: [PATCH] fix : display carriage problem --- sources/utility.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sources/utility.py b/sources/utility.py index 86126f1..3e1a811 100644 --- a/sources/utility.py +++ b/sources/utility.py @@ -90,11 +90,12 @@ def animate_thinking(text, color="status", duration=120): break symbol = next(spinner) if platform.system().lower() != "windows": - print(f"{fore_color}{symbol} {text}{Fore.RESET}", flush=True) + print(f"\r{fore_color}{symbol} {text}{Fore.RESET}", end="", flush=True) else: - print(colored(f"{symbol} {text}", term_color), flush=True) - time.sleep(0.1) - print("\033[1A\033[K", end="", flush=True) + print(f"\r{colored(f'{symbol} {text}', term_color)}", end="", flush=True) + time.sleep(0.2) + print("\r" + " " * (len(text) + 7) + "\r", end="", flush=True) + print() animation_thread = threading.Thread(target=_animate, daemon=True) animation_thread.start()