Skip to content

fix(list): measure truncated cells by grapheme cluster so VS16 emoji don't overflow - #4682

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-4681
Nov 3, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-4681

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

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 #4681 — automated triage

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
@worktrunk-bot worktrunk-bot added the automated-fix Automated CI fix label Nov 3, 2026
@max-sixty
max-sixty merged commit 5b35ef6 into main Nov 3, 2026
41 of 50 checks passed
@max-sixty
max-sixty deleted the fix/issue-4681 branch November 3, 2026 12:33
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wt list: VS16 emoji in commit subjects (♻️, ⬆️) overflow the Message column, so rows wrap and the live table stacks stale frames

2 participants