Skip to content

Fix TTY timer rendering when duration length changes#13634

Merged
ndeloof merged 2 commits intodocker:mainfrom
MaybeSam05:fix-tty-timer-padding
Mar 20, 2026
Merged

Fix TTY timer rendering when duration length changes#13634
ndeloof merged 2 commits intodocker:mainfrom
MaybeSam05:fix-tty-timer-padding

Conversation

@MaybeSam05
Copy link
Contributor

What I did

  • Fixed the TTY progress timer rendering so that when one task has a longer elapsed time (e.g. 10.6s) and others are shorter (e.g. 0.0s), the shorter timers correctly overwrite any previous content.
  • Normalized the timer column width by padding each timer string to the maximum visible timer length before rendering, preventing artifacts like 0.0ss from leftover characters.

Related issue
Fixes #13633

@MaybeSam05 MaybeSam05 requested a review from a team as a code owner March 12, 2026 19:57
@MaybeSam05 MaybeSam05 requested review from glours and ndeloof March 12, 2026 19:57
Signed-off-by: Samarth Verma <verma.samarth05@gmail.com>
@MaybeSam05 MaybeSam05 force-pushed the fix-tty-timer-padding branch from e1d83a0 to cecb55b Compare March 12, 2026 19:59
}
timerWidth := utf8.RuneCountInString(l.timer)
if timerWidth < timerLen {
l.timer = l.timer + strings.Repeat(" ", timerLen-timerWidth)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use left-padding to align counter on terminal right

Signed-off-by: Samarth Verma <verma.samarth05@gmail.com>
@MaybeSam05
Copy link
Contributor Author

Implemented left-padding for the timer column so the timer aligns on the terminal right edge. Also added a regression test to cover differing timer widths. Thanks @ndeloof.

@ndeloof ndeloof enabled auto-merge (rebase) March 20, 2026 14:02
@ndeloof ndeloof merged commit 0d8dc09 into docker:main Mar 20, 2026
39 checks passed
@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/display/tty.go 71.42% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] incorrect timming output pattern when seconds goes to 2 digits

2 participants