Skip to content

feat: long text in a column wraps to the column's width instead of being clipped - #41

Merged
eigger merged 6 commits into
mainfrom
feat/stack-text-wrap
Oct 3, 2026
Merged

eigger merged 6 commits into
mainfrom
feat/stack-text-wrap

Conversation

@eigger

@eigger eigger commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Layout UX: in a narrow column/card a long text child used to be silently clipped (stack children are cropped to the stack), and wrapping needed max_width computed by hand. A vertical stack now word-wraps a text child that is wider than its slot (inner width minus the child's margins), keeping explicit \n. Lines are measured by drawing them in 1-bit (hinted glyphs come out wider than getlength, which left the last glyph clipped — found by looking at the render). Untouched: text that fits, max_width, rotated text, rows (the slot width is unknown there), non-text children. Built on #40 (multi-line anchor fix).

🤖 Generated with Claude Code

eigger and others added 6 commits October 3, 2026 10:19
…ing clipped

A stack clips what overflows it, so a long text child in a narrow column was cut off
(no way to wrap without max_width). In a vertical stack, a text child wider than the
slot is now word-wrapped to the inner width minus margins, keeping explicit newlines.
Measured by drawing in 1-bit, since hinted glyphs are wider than getlength reports.
Text that fits, with max_width, rotated, or in a row is untouched.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ld, ink-measure only near the edge, stronger tests

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ly when over

The per-word estimate can be a pixel or two short for some fonts (hinting drift across
spaces/digits). Every line accepted without a draw is now checked once; an overflowing
one is re-wrapped with an always-draw ruler, so no font can clip a wrapped line.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…tic sabotage tests

Paragraphs accepted by the estimate are now verified by drawing too. The sabotage tests
use a font proxy that under-reports advances by 25%, so they exercise the verification on
every platform (the previous ones depended on macOS hinting and failed on Linux/Pillow 10.4).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@eigger
eigger merged commit 9c5ba66 into main Oct 3, 2026
5 checks passed
@eigger
eigger deleted the feat/stack-text-wrap branch October 3, 2026 01:52
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.

1 participant