Redraw a finished bar below a warning for its last file (closes #102) #103

Merged
clawbot merged 1 commits from issue-102-warn-keeps-final-bar into next 2026-10-14 19:55:59 +02:00
Collaborator

On a terminal, a warning for the last file a hash or content phase reads erased that phase's finished bar (#102). warnf clears the bar's line before it prints a warning. In the middle of a phase the next item draws the bar again below the warning, but once a bar has reached its total the progress library never draws it again, so the warning was left where the bar's last line had been.

warnf now draws a finished bar's last frame again below the warning. The frame is the one the library last drew, so its count, rate and elapsed time are those from when the phase's last item completed, not from when the warning was printed.

TestWarningAfterLastItemKeepsBar in progress_test.go is the test the definition of done describes: a bar with total 2, two items, one warning, then finish, and the terminal's last frame must hold (2/2,. It fails on the current next.

Unchanged: output when stderr is not a terminal, and warnings shown during a spinner, which take a separate branch of warnf that returns before the new code.

Model: opus-5-5

On a terminal, a warning for the last file a `hash` or `content` phase reads erased that phase's finished bar (https://git.eeqj.de/sneak/sfdupes/issues/102). `warnf` clears the bar's line before it prints a warning. In the middle of a phase the next item draws the bar again below the warning, but once a bar has reached its total the progress library never draws it again, so the warning was left where the bar's last line had been. `warnf` now draws a finished bar's last frame again below the warning. The frame is the one the library last drew, so its count, rate and elapsed time are those from when the phase's last item completed, not from when the warning was printed. `TestWarningAfterLastItemKeepsBar` in `progress_test.go` is the test the definition of done describes: a bar with total 2, two items, one warning, then `finish`, and the terminal's last frame must hold `(2/2,`. It fails on the current `next`. Unchanged: output when stderr is not a terminal, and warnings shown during a spinner, which take a separate branch of `warnf` that returns before the new code. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 19:47:38 +02:00
clawbot self-assigned this 2026-10-14 19:47:38 +02:00
clawbot added 1 commit 2026-10-14 19:47:39 +02:00
On a terminal, warnf clears the bar's line before it prints a warning.
When the warning is for the last item of a phase, the bar has already
drawn its finished frame and the progress library draws nothing more
for a finished bar, so the warning took the bar's place for good. warnf
now draws the finished bar's last frame again below the warning.
Output when stderr is not a terminal does not change.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit a4d76af8fe into next 2026-10-14 19:55:59 +02:00
clawbot deleted branch issue-102-warn-keeps-final-bar 2026-10-14 19:56:00 +02:00
Sign in to join this conversation.