Repository navigation
fix(list): measure truncated cells by grapheme cluster so VS16 emoji don't overflow - #4682
Merged
Merged
Conversation
truncate_visible summed per-char widths, so a VS16 emoji presentation sequence such as ♻️ (U+267B U+FE0F) counted as 1 cell while the terminal and every other width measure in the layout count it as 2. A truncated Message cell starting with one came out a cell wider than its column, wrapping the row and breaking the progressive wt list redraw. Walk grapheme clusters and measure each with the string width, which also keeps a cut from splitting a base character from its selector. Closes #4681
Yash2031v
pushed a commit
to Yash2031v/worktrunk
that referenced
this pull request
Nov 3, 2026
…don't overflow (max-sixty#4682) `truncate_visible` summed per-`char` widths, so a VS16 emoji presentation sequence such as `♻️` (`U+267B U+FE0F`) measured 1 + 0 = 1 cell, while the terminal and the rest of the layout (`UnicodeWidthStr::width`) count it as 2. A truncated Message cell starting with one came out one cell wider than its column, which wraps the row in `wt list | cat` and throws off the progressive renderer's cursor math. The loop now walks grapheme clusters and measures each with the string width, so the kept prefix agrees with every other width measure and a cut can no longer split a base character from its selector. `unicode-segmentation` 1.12 was already in `Cargo.lock` transitively; this adds it as a direct dependency. The new assertions in `test_truncate_visible` fail on the old loop (`"♻️ refactor:…"`, 13 cells for a 12-cell budget) and pass now. Running the issue's repro at `COLUMNS=100` against the fixed build, both Message cells (`✨ feat: ad…` and `♻️ refactor…`) are 12 cells. Closes max-sixty#4681 — automated triage Co-authored-by: worktrunk-bot <[email protected]>
1 task
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.
truncate_visiblesummed per-charwidths, so a VS16 emoji presentation sequence such as♻️(U+267B U+FE0F) measured 1 + 0 = 1 cell, while the terminal and the rest of the layout (UnicodeWidthStr::width) count it as 2. A truncated Message cell starting with one came out one cell wider than its column, which wraps the row inwt list | catand throws off the progressive renderer's cursor math. The loop now walks grapheme clusters and measures each with the string width, so the kept prefix agrees with every other width measure and a cut can no longer split a base character from its selector.unicode-segmentation1.12 was already inCargo.locktransitively; this adds it as a direct dependency.The new assertions in
test_truncate_visiblefail on the old loop ("♻️ refactor:…", 13 cells for a 12-cell budget) and pass now. Running the issue's repro atCOLUMNS=100against the fixed build, both Message cells (✨ feat: ad…and♻️ refactor…) are 12 cells.Closes #4681 — automated triage