Repository navigation
Keep a paragraph’s closing whitespace on its last row and in its width - #7
Draft
francois-unity wants to merge 2 commits into
Draft
francois-unity wants to merge 2 commits into
francois-unity wants to merge 2 commits into
Conversation
chris-addison
force-pushed
the
unity/a11y-automation
branch
from
October 6, 2026 18:24
2805d34 to
33d34a1
Compare
Parley’s line breaker hangs a space that overflows a row and then breaks, so a space that ends the paragraph leaves an empty row behind, and that row counts in the layout height. A block’s max-content width comes from Layout::width(), which leaves trailing whitespace out, so laying the text out again at exactly that width always wraps it: a box holding "Visit our " measured one row taller than the text it paints. CSS hangs that whitespace instead. After line breaking, a paragraph whose last rows hold only whitespace after a soft break is now broken again: the earlier rows as before, and the last one with no width limit, still aligned within the wrap width. That covers several trailing spaces, whitespace-only text and clamped layouts, and the empty row Parley also leaves after an oversized inline box that ends a paragraph. A forced break (U+2028) still starts its own row, and widths don’t change, since Layout::width() already left the hanging whitespace out.
The previous commit hangs a paragraph’s closing whitespace on its last row instead of wrapping it onto an empty one. A block still measured its width with Layout::width(), which leaves trailing whitespace out, so a fragment ending in a space now sat flush against the next one: in a sentence built from fragments, "Visit our " followed by a link read "Visit ourdownload archive". A text element’s width (LineLayout::width) already keeps that space. A block’s width now counts the whitespace that ends its paragraph when it fits in the width the paragraph was given, so a block laid out again at its own measured width keeps both its row and its space. When it doesn’t fit, it still hangs and stops counting. Whitespace before a forced break and the spaces a soft wrap hangs still don’t count. The element test now builds that sentence as a baseline-aligned flex row and checks both its row and its space, and a unit test pins when the space counts.
francois-unity
force-pushed
the
unity/HUB-8048-hang-trailing-whitespace
branch
from
October 6, 2026 18:29
e815e6b to
708f827
Compare
This was referenced Oct 6, 2026
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.
Keeps the whitespace that ends a paragraph on its last row, and counts it in the paragraph’s block width when it fits, so a block ending in a space neither grows an empty row nor loses its space.
Why: Parley’s line breaker hangs a space that overflows a row and then breaks, so a space that ends the paragraph leaves an empty row behind, and that row counts in the layout height. A block’s max-content width comes from
Layout::width(), which leaves trailing whitespace out, so laying the text out again at exactly that width always wraps it. In the native Unity Hub,div().child("Can’t find the version you’re looking for? Visit our ")laid out at 303×40 instead of 303×20 (Inter 13px on a 20px line), and a baseline-aligned row of such fragments dropped its link a line (HUB-8048).parley_paragraph_layoutbreaks the paragraph again, the earlier rows as before and the last one with no width limit, still aligned within the wrap width. That also removes the empty row Parley leaves after an oversized inline box that ends a paragraph. A forced break (U+2028) still starts its own row.LineLayout::width) already does. When it doesn’t fit, it hangs and stops counting.How to test
cargo +1.98.1 test -p gpui_ce_parley: four new tests intext_system/tests/inline_reflow.rs, each failing without the fix: the Hub’s footer sentence as a baseline-aligned flex row (one row, space kept), the closing-space width rule, the text system at its own width with and without a line clamp, and an oversized trailing inline box.block_line_clamp_ignores_wrapped_trailing_whitespacestays green.cargo +1.98.1 test -p gpui_ce_elements -p gpui_ce_macosstays green.bindgenbuild-script error before reaching this code; Declare gpui_media’s bindgen build dependency on every host #6 fixes that.unity/wayland-early-app-id(unity/HUB-8048-hub-pin-3,6f7e4cfe3b), since its pin also carries elements/div: add an aria_url passthrough #4 and the test text system commit.