Repository navigation
Conversation
djc
approved these changes
Nov 9, 2026
| } | ||
|
|
||
| let diff = width - cols; | ||
| let diff = (width - cols) / char_width(pad).max(1); |
Member
There was a problem hiding this comment.
Nit: I prefer to use a symmetric max() like Ord::max().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pad_str_with("a", 5, Alignment::Right, None, '\u{754c}')returns four wide padding characters, producing nine columns instead of five.Count complete padding characters by their display width before applying the existing alignment split. Leave any indivisible remainder unused and document the resulting narrower field. Zero-width padding and builds without
unicode-widthkeep their previous repetition behavior.Regression tests cover each alignment, non-divisible widths, empty and wide input, emoji padding, ANSI input, zero-width/control padding, feature-disabled behavior, and the unchanged borrowing/truncation paths.
Fixes #305.
Validation from the repository root on Linux (Rust 1.94.1):
make test(all seven feature combinations),make check, andmake doccargo fmt --all -- --checkcargo clippy --examples --tests --all-features -- --deny warningscargo +1.71.0 check --lib --all-features --locked --offlineThe new wide-padding and ANSI regression tests fail on unmodified main. Windows/macOS, WASM/WASI, and minimal-dependency-version CI were not run locally.