Skip to content

Fix truncate for small max_len values#72

Merged
msaroufim merged 1 commit into
mainfrom
fix/truncate-small-max-len
Jul 5, 2026
Merged

Fix truncate for small max_len values#72
msaroufim merged 1 commit into
mainfrom
fix/truncate-small-max-len

Conversation

@msaroufim

Copy link
Copy Markdown
Member

Summary

  • handle truncate widths below the ellipsis length without panicking
  • ensure truncated UTF-8 strings are sliced only at valid character boundaries
  • add regression coverage for tiny max_len values and non-ASCII input

Closes #68.

Testing

  • cargo fmt --check
  • cargo test

@msaroufim msaroufim marked this pull request as ready for review July 5, 2026 23:25
@msaroufim msaroufim merged commit 5e4a580 into main Jul 5, 2026
5 checks passed
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.

truncate panics for max_len values below 3

1 participant