Repository navigation
fix(cli): erase stale bar rows and keep the run header in a bundle get - #2481
Conversation
The in-place redraw from #2480 has two gaps in indicatif 0.18: - When the stack shrinks (a finished file's bar clears), the rows it no longer covers are never erased, so old total lines pile up under it. The container is now bottom-aligned, so a shrunk stack pads its top with blank lines, and its draw target erases each padding row as it writes it. - The run header, printed with println before any bar exists, is overwritten by the first bar. It now goes out through suspend with its own newline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Correctness rests on indicatif 0.18's internal terminal draw behavior and visual output that cannot be verified in this environment, and the author left the real-terminal manual check unchecked, so final human visual verification is warranted.
0 open findings
What changed in this PR
This is a follow-up to #2480. That PR switched the CLI's bundle decdn get progress stack to an in-place redraw (set_move_cursor(true)) to stop flicker, but introduced two regressions in indicatif 0.18: (1) when the bar stack shrinks, rows it no longer covers are never erased and pile up as stale total lines; and (2) the run header printed via MultiProgress::println is overwritten by the first bar. This PR fixes both by bottom-aligning the stack and wrapping buffered stderr in an ErasingStderr TermLike that clears each row before writing, and by emitting the header through suspend(|| eprintln!(...)).
Changes:
- Add a bottom-aligned, in-place draw target backed by
ErasingStderr(aTermLikeoverconsole::Term::buffered_stderr()) for terminal stderr; non-terminal stderr keeps indicatif's auto-hiding stderr target. - Emit the run header through
MultiProgress::suspend+eprintln!so the first bar no longer overwrites it. - Promote
console0.16 to a direct dependency (already in the tree under indicatif).
| File | Description |
|---|---|
crates/cli/src/logging.rs |
Adds new_container terminal branch with term_like_with_hz, bottom alignment, the ErasingStderr TermLike wrapper, and the REFRESH_HZ constant. |
crates/cli/src/commands/pull_progress.rs |
Replaces mp.println(header) with `mp.suspend( |
crates/cli/Cargo.toml |
Declares the console workspace dependency for decdn-cli. |
Cargo.toml |
Adds console = "0.16" to [workspace.dependencies]. |
Cargo.lock |
Records the new console 0.16.6 edge for decdn-cli. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
) #2481 bottom-aligned the stack so a shrunk stack's blank padding rows overwrote the rows it left, which slides the bars down the screen as files finish. A blank pad bar under the total now holds the stack's height instead: it gains a row before each file bar clears and gives one back after each new bar is inserted, so the stack stays at the top and never shrinks. The top alignment needs no custom draw target, so ErasingStderr and the direct console dependency go. Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Follow-up to #2480. Its in-place redraw has two gaps in indicatif 0.18, both visible in a bundle
decdn get:totallines pile up under the live stack. The container is now bottom-aligned, so a shrunk stack pads its top with blank lines, and a smallTermLikewrapper over buffered stderr (ErasingStderr) erases each padding row as it writes it. A non-terminal stderr keeps indicatif's own stderr target, so bars stay hidden there.printlnbefore any bar exists, gets overwritten by the first bar. It now goes out throughsuspendwith its own newline.console0.16 becomes a direct dependency; it is already in the tree under indicatif.One side effect: indicatif picks bar colours from stdout's colour support for a
TermLiketarget, so with stdout piped (-o -) the bars render uncoloured.Test plan
cargo clippy -p decdn-cli --all-targets -- -D warnings,cargo fmt --checkcargo test -p decdn-cli progressdecdn getin a tmux pane🤖 Generated with Claude Code