Add multiline layout and row wrapping to UI trees (#60026)

## What changed

Render prepared UI trees within a viewport's width and height, preserving authored line breaks and wrapping text while retaining styles and hyperlink ranges.

- Add `wrap: "wrap"` for rows to move children onto additional lines; keep `nowrap` as the default.
- Allocate space to row children while reserving later siblings' minimum widths.
- Mark horizontal clipping and vertical overflow with an unlinked ellipsis, including in single-line rendering.
- Respect word hyphens across style boundaries and nonbreaking spaces when wrapping.

## Testing

Add regression tests for nested row wrapping, sibling width allocation, hyperlink offsets and clipping, and word boundaries. Add a buffer snapshot covering authored line breaks, collapsed whitespace, styles, and links.

GitOrigin-RevId: fdfbdee92808c0a8f55e2fdf11db95d68a76d9a5
This commit is contained in:
Joe Savona
2026-11-07 01:49:05 +00:00
committed by copyberry
parent d749ee847f
commit 8e7ccd8472
7 changed files with 436 additions and 70 deletions
+14
View File
@@ -113,6 +113,20 @@ pub(crate) struct RowProps {
skip_serializing_if = "Option::is_none"
)]
background: Option<Color>,
#[serde(
default,
deserialize_with = "decode::token",
skip_serializing_if = "is_default"
)]
wrap: RowWrap,
}
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
enum RowWrap {
#[default]
Nowrap,
Wrap,
}
fn is_default<T: Default + PartialEq>(value: &T) -> bool {