Skip to content

Include labels in fast progress bar width - #331

Merged
wolph merged 1 commit into
wolph:developfrom
rupayon123:fix/fast-label-width-budget-20261029
Nov 1, 2026
Merged

wolph merged 1 commit into
wolph:developfrom
rupayon123:fix/fast-label-width-budget-20261029

Conversation

@rupayon123

Copy link
Copy Markdown
Contributor

The known-length fast bar allocates the whole terminal width to its status and bar, then adds prefix/desc and suffix. An ordinary labeled bar can overflow an 80-column terminal to 95 columns.

Reserve the measured fixed text before sizing the filler. Use the existing custom_len callback so ANSI colors and custom display widths are handled consistently.

CPython 3.13.14 / macOS arm64 validation:

  • Ten label-width regressions fail before the fix; all 52 affected cases pass afterward.
  • The repository's actual pip/tox route passes 1,251 tests with 16 existing skips, Pyright, and 100% configured line/branch coverage.
  • Ruff, codespell, strict docs, native demo and package checks pass.
  • Real PTY comparisons reproduce 95-column frames before the fix and 80 afterward. Independent PTY checks cover 80/110-column labels, ANSI text, the unchanged spinner path and short-terminal behavior.

Fixed text wider than the terminal is still not truncated. Optional custom/native formatter hooks are unchanged; other platform/runtime combinations and hosted CI remain unverified locally.

@wolph
wolph merged commit c24f238 into wolph:develop Nov 1, 2026
14 of 18 checks passed
wolph added a commit that referenced this pull request Nov 1, 2026
…e fast path after #331

4.6.0 rendered prefix and suffix through an f-string and never called
custom_len on the fast path. #331 concatenates the labels and calls
custom_len for the width, so an int label raised TypeError and
custom_len=None or a float-returning custom_len raised. Stringify the
labels, fall back to len_color for an uncallable custom_len and truncate
its result to int. Tests pin the three cases.
@wolph

wolph commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thank you for the fix! Overflowing the terminal with a label was a 4.6.0 regression, so this brings it back to what 4.5.0 did. I've added a small guard that keeps non-str labels and an uncallable custom_len working on the fast path as they did in 4.6.0 (892eba0), but everything is merged beyond that :)

wolph added a commit that referenced this pull request Nov 1, 2026
tox 4.67.5 rejects an empty changedir ("path value is empty"), which
turned the docs, docs-demos, readme and console jobs red on develop and
on #331. The five envs that left it empty now say {toxinidir}, which is
what the empty value meant.

Copy link
Copy Markdown
Contributor Author

I checked the formatter guard with the existing 31 focused tests; they pass, including non-string labels and a non-callable custom_len. I also reproduced the empty changedir failure with tox 4.67.5. Your 05a60c9 fix resolves that configuration error, and docs, docs-demos and the strict README build now pass locally on CPython 3.13.14. The hosted checks still need their own result.

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.

2 participants