You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Progress spinner flickers when the "Refreshing model pricing…" status line wraps on narrow terminals #1411
On an 80-column terminal, every online ccusage run shows this line flickering rapidly until loading finishes:
⠏ Refreshing model pricing from LiteLLM... :: Loading usage logs (0/2) :: Claude, Codex
That combined status is ~85 chars, so on my 80-col terminal it wraps to two rows. The spinner redraw in ProgressState::render (rust/crates/ccusage/src/progress.rs) writes "\r\x1b[K…" every 80ms — \x1b[K only clears the current line, so each frame leaves the wrapped remnant behind, which reads as flicker. Running with -O (which skips the pricing status) avoids it entirely, matching this diagnosis.
Reproduce
Terminal width ≤ ~84 columns
ccusage (online, no -O)
Watch the status line — the flicker is deterministic.
Suggested fix
Truncate the status to terminal_width() - 2 display columns before writing, so it can never wrap (the single-line \r\x1b[K clear then stays correct). terminal_width() is already imported into the crate from ccusage-terminal, so this needs no new dependency.
This issue was auto-closed. Issues from new contributors are auto-closed by default.
Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply.
Keep the issue short, concrete, and written in your own voice.
If a maintainer replies lgtmi, your future issues will stay open. If a maintainer replies lgtm, your future issues and PRs will stay open.
Thanks for reopening this. I've got the fix ready and would be happy to open a PR once approved.
Root cause: ProgressState::render clears with a single-line \r\x1b[K, but the combined status (Refreshing model pricing from LiteLLM... :: Loading usage logs (0/2) :: Claude, Codex, ~85 cols) wraps on terminals ≤84 cols, so the wrapped remnant is never erased → flicker.
Fix: truncate the status to terminal_width() - 2 before writing so the line always stays single-row, via a small CJK-aware truncate_to_width helper in ccusage-terminal. +76 lines across progress.rs and ccusage-terminal, no new deps.
Verified on the pinned 1.96.0 toolchain: cargo fmt --check, cargo clippy --all-targets -- -D warnings, and tests all green (adds 3 width tests + 1 progress test, no regressions).
Historical audit: this discussion was auto-closed by the legacy contributor gate. That closure did not assess technical importance.
Audit result: resolved. A later merged change or the current main implementation covers this request. This item is kept for history and does not need to be reopened.
Activity
github-actions commentedon Jul 9, 2026
This issue was auto-closed. Issues from new contributors are auto-closed by default.
Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply.
Keep the issue short, concrete, and written in your own voice.
If a maintainer replies
lgtmi, your future issues will stay open. If a maintainer replieslgtm, your future issues and PRs will stay open.See CONTRIBUTING.md.
pzhang819 commentedon Jul 11, 2026
Thanks for reopening this. I've got the fix ready and would be happy to open a PR once approved.
Root cause:
ProgressState::renderclears with a single-line\r\x1b[K, but the combined status (Refreshing model pricing from LiteLLM... :: Loading usage logs (0/2) :: Claude, Codex, ~85 cols) wraps on terminals ≤84 cols, so the wrapped remnant is never erased → flicker.Fix: truncate the status to
terminal_width() - 2before writing so the line always stays single-row, via a small CJK-awaretruncate_to_widthhelper inccusage-terminal. +76 lines acrossprogress.rsandccusage-terminal, no new deps.Verified on the pinned 1.96.0 toolchain:
cargo fmt --check,cargo clippy --all-targets -- -D warnings, and tests all green (adds 3widthtests + 1progresstest, no regressions).Happy to send the PR whenever you
lgtm.fix(progress): keep the spinner status on a single row (ccusage#1500)
ryoppippi commentedon Aug 31, 2026
Historical audit: this discussion was auto-closed by the legacy contributor gate. That closure did not assess technical importance.
Audit result: resolved. A later merged change or the current
mainimplementation covers this request. This item is kept for history and does not need to be reopened.