From 1e650d8144bd09d82258b986837878c7ac0cd820 Mon Sep 17 00:00:00 2001 From: tw93 Date: Fri, 30 Jan 2026 18:16:31 +0800 Subject: [PATCH] fix: use \033[2K to fully clear spinner lines and prevent text remnants Fixes text remnants showing when spinner messages change from longer to shorter text. Changed from \033[K (clear to end of line) to \033[2K (clear entire line) in stop_section_spinner(), safe_clear_line(), and safe_clear_lines() functions. Fixes #390 --- lib/core/base.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/base.sh b/lib/core/base.sh index 0f0170c..17a579e 100644 --- a/lib/core/base.sh +++ b/lib/core/base.sh @@ -628,7 +628,7 @@ start_section_spinner() { stop_section_spinner() { stop_inline_spinner 2> /dev/null || true if [[ -t 1 ]]; then - echo -ne "\r\033[K" >&2 || true + echo -ne "\r\033[2K" >&2 || true fi } @@ -646,7 +646,7 @@ safe_clear_lines() { # Clear lines one by one (more reliable than multi-line sequences) local i for ((i = 0; i < lines; i++)); do - printf "\033[1A\r\033[K" > "$tty_device" 2> /dev/null || return 1 + printf "\033[1A\r\033[2K" > "$tty_device" 2> /dev/null || return 1 done return 0 @@ -660,7 +660,7 @@ safe_clear_line() { # Use centralized ANSI support check is_ansi_supported 2> /dev/null || return 1 - printf "\r\033[K" > "$tty_device" 2> /dev/null || return 1 + printf "\r\033[2K" > "$tty_device" 2> /dev/null || return 1 return 0 }