🎨 Palette: Prevent trailing text artifacts in dynamic CLI updates#95
🎨 Palette: Prevent trailing text artifacts in dynamic CLI updates#95
Conversation
Replaced hardcoded padding spaces with the ANSI escape sequence \033[K (Erase in Line) immediately after a carriage return (\r) in src/main.cpp. This provides a cleaner and more robust dynamic terminal UI update by guaranteeing that shorter texts completely overwrite longer ones without leaving visual artifacts. Also added a journal entry in .Jules/palette.md to record this UX learning. Co-authored-by: EiJackGH <172181576+EiJackGH@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What:
Added the ANSI escape sequence
\033[K(Erase in Line) after carriage returns (\r) in the dynamic terminal UI, replacing hardcoded padding spaces.🎯 Why:
When updating a single line in a terminal with new, shorter text, the end of the older, longer text is typically left visible unless padding spaces are used. However, padding spaces are a fragile solution, particularly when the exact length needed is variable or when dealing with smaller terminal sizes where word wrap might occur. Utilizing the
\033[Kescape sequence ensures a mathematically clean update, completely erasing any text from the cursor position to the end of the line, guaranteeing no trailing artifacts and maintaining a pristine view.📸 Before/After:
N/A (This fixes potential rendering artifacts, making dynamic strings like the countdown or score shorter/longer robust on line changes).
♿ Accessibility/UX:
Provides a much cleaner and glitch-free real-time updating experience for users interacting with the terminal application, ensuring that score and status updates are consistently legible and professionally displayed regardless of terminal width.
Testing details:
Tests passing (
make,verify_ux.py, andtest_bitcoin.py). Removed temporaryoutput.logfrom test captures so it is not tracked in VC.PR created automatically by Jules for task 9530679294071667356 started by @EiJackGH