A full-window side column's paragraphs wrap at a dialog's line length, and a row notice offered no room takes at most the column's room (DIAG: notice widths in the Content-Aware Fill tests)

This commit is contained in:
aiongg
2026-11-17 05:13:50 +00:00
parent 06e8f642e2
commit ec64d98b70
2 changed files with 12 additions and 8 deletions
@@ -3,7 +3,7 @@
use crate::contract::{
BodyCx, Common, Component, Container, ContainerProps, Cx, FooterPlace, HeaderRegion, NoValue, Outcome, Pad, Props as _, Role, RowAlign, Scroll,
Show as _, ShowContainer as _, Sizing, WordSetCx as _,
Show as _, ShowContainer as _, Sizing, WordSetCx as _, WrapWidth,
};
use crate::layout_components::Row;
use crate::runtime::focus::FocusPolicy;
@@ -99,7 +99,8 @@ impl Outcome for FullWindowSideOutput {
/// [`headerless`](Self::headerless); the body padded by the panel tier.
/// - **Body.** Scrolls vertically when taller than the room; [`unscrolled`](Self::unscrolled) leaves the scroll out
/// for a pane that bounds itself.
/// - **Size.** As wide as its content; as high as its content, at most the room of the side columns.
/// - **Size.** As wide as its content; as high as its content, at most the room of the side columns. Its paragraphs
/// (a message, a failure) wrap at a dialog's line length, so a long one does not widen the column past it.
/// - **Footer.** None of its own: the dialog's buttons sit in the dialog's footer, which [`SideFooter`] places among
/// the side columns.
/// - **Keyboard and AccessKit.** A group named by the label, an F6 pane; Tab goes top to bottom.
@@ -121,6 +122,7 @@ impl FullWindowSide {
.surface(SurfaceKind::Panel)
.pad(Pad::Regular)
.sizing(Sizing::Content)
.wrap_width(WrapWidth::Dialog)
.header(HeaderRegion::new().rule(true))
.scroll(Scroll::vertical())
.focus(FocusPolicy::PANE);
+8 -6
View File
@@ -558,14 +558,16 @@ impl Component for Notice<'_> {
room.map_or(width, |room| width.min(room))
}
(NoticeLayout::Centred, None) => natural.min(cx.style.reading_width),
// A row notice takes the room it is given; an unbounded room (a column sized by its content) leaves it at
// its natural width.
(_, Some(room)) if room.is_finite() => room,
(_, _) => natural,
(_, Some(room)) => room,
// A row notice offered no room (a unit of a row, a column sized by its content) takes its line, at most
// the column's room: in a container that sets a line length, its paragraphs' wrap width.
(_, None) => cx.column_room().map_or(natural, |column| natural.min(column)),
};
if !width.is_finite() || cx.room.is_some_and(|room| !room.is_finite()) {
{
let test = std::thread::current().name().unwrap_or("?").rsplit("::").next().unwrap_or("?").to_owned();
eprintln!("DIAG {test}: notice measure room {:?} natural {natural} width {width}", cx.room);
if test.starts_with("an_erased_sampling") || test.starts_with("brush_strokes_change") {
eprintln!("DIAG {test}: notice measure room {:?} column {:?} natural {natural} width {width}", cx.room, cx.column_room());
}
}
Vec2::new(width, self.plan(cx, &texts, self.wrap_width(cx, width)).height)
}