Repository navigation
fmt: match GNU wrapping for explicit widths - #12623
wondr-wclabs wants to merge 1 commit into
Conversation
|
GNU testsuite comparison: |
|
I wouldn't apply this as GNU fmt 9.10 was changed to not including the newline in the count. |
|
Thanks for the context. I agree this should not land as-is. The PR was targeting the older observed GNU behavior from #10095 where explicit widths effectively lost one visible column to the terminating newline, but that direction is now stale if GNU fmt 9.10 no longer counts the newline and upstream is also about to improve multibyte width handling. The failing comparison is a good signal that this patch would move uutils toward behavior GNU no longer wants to preserve. Closing this PR rather than trying to paper over that failure. A better follow-up would be to retest #10095 against current GNU fmt and then make a narrower patch around the remaining multibyte display-width differences, if any, instead of adjusting the explicit width budget globally. |
|
Small correction to my previous comment: the failing comparison I meant was |
Fixes #10095.
GNU
fmtcounts the terminating newline against an explicit-w/--widthvalue, so the visible line content budget is one column lower than the user-supplied width. uutils was using the full width as visible content budget, which allowed lines such asaa bb ccat-w 8and kept some wide-character examples on one line where GNU wraps earlier.This keeps validation against the user-supplied width first, then adjusts only the internal line-breaking width/goal for explicit widths. The default width path stays unchanged.
The regression coverage uses the ASCII and Unicode examples from the issue so the intended GNU-compatible wrapping is visible in tests.