diff --git a/crates/imaging/tests/it/select.rs b/crates/imaging/tests/it/select.rs index 4a302e8e5..dfb6baf0e 100644 --- a/crates/imaging/tests/it/select.rs +++ b/crates/imaging/tests/it/select.rs @@ -175,6 +175,10 @@ where SelectToolPass::new(&mut *self.tool.borrow_mut(), &self.probe).claims() } + fn takes_every_move(&self) -> bool { + SelectToolPass::new(&mut *self.tool.borrow_mut(), &self.probe).takes_every_move() + } + fn access(&self, cx: &ToolContext<'_>) -> Option { SelectToolPass::new(&mut *self.tool.borrow_mut(), &self.probe).access(cx) } diff --git a/crates/ui-canvas/src/canvas/full_window_parts/side.rs b/crates/ui-canvas/src/canvas/full_window_parts/side.rs index a2a575df7..16e99a842 100644 --- a/crates/ui-canvas/src/canvas/full_window_parts/side.rs +++ b/crates/ui-canvas/src/canvas/full_window_parts/side.rs @@ -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); diff --git a/crates/ui-contract/src/contract/body/inherit.rs b/crates/ui-contract/src/contract/body/inherit.rs index 53772b857..528d95f04 100644 --- a/crates/ui-contract/src/contract/body/inherit.rs +++ b/crates/ui-contract/src/contract/body/inherit.rs @@ -126,10 +126,13 @@ impl BodyHooks<'_> { if scroll.is_some() || props.scroll_owner { scoped.scroll_owner = Some(ScrollOwner { id, view: scroll.is_none() }); } - match scroll { - Some(scroll) => scoped.unbounded = (scroll.horizontal_on(), scroll.vertical_on()), - // A container that sized an axis itself (a rect it was shown at, a fixed layer) bounds the room along it. - None => scoped.unbounded = (scoped.unbounded.0 && !self.room.x.is_finite(), scoped.unbounded.1 && !self.room.y.is_finite()), - } + // A container that sized an axis itself (a rect it was shown at, a fixed layer) bounds the room along it; one + // measured in a room unbounded along an axis it does not scroll (a row's probe for its units' leasts) leaves + // that axis unbounded, so its children never take a width from an infinite rect. + let (x, y) = (scoped.unbounded.0 && !self.room.x.is_finite(), scoped.unbounded.1 && !self.room.y.is_finite()); + scoped.unbounded = match scroll { + Some(scroll) => (scroll.horizontal_on() || x, scroll.vertical_on() || y), + None => (x, y), + }; } } diff --git a/crates/ui-widgets/src/notices/notice.rs b/crates/ui-widgets/src/notices/notice.rs index 6c4ae9ae6..77ff16043 100644 --- a/crates/ui-widgets/src/notices/notice.rs +++ b/crates/ui-widgets/src/notices/notice.rs @@ -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) } diff --git a/crates/ui-widgets/src/pickers/face.rs b/crates/ui-widgets/src/pickers/face.rs index 262e4aa1f..c7c24cfca 100644 --- a/crates/ui-widgets/src/pickers/face.rs +++ b/crates/ui-widgets/src/pickers/face.rs @@ -54,7 +54,8 @@ pub enum FaceKind { /// and the chevron need, at least a field wide; a [fitted](SelectFace::fit) box is at most a field wide and has no /// floor; a thumbnail alone takes only its own width. A host shows it as the look of one of its parts with /// `ui.face(part, SelectFace::new(text))` over the field well it paints itself, and gives the box the width of its -/// widest text so the width does not change with the pick. A thumbnail goes before the text, or alone. +/// widest text so the width does not change with the pick. A thumbnail goes before the text, or alone. The face is +/// no node of its own: its text is the pick, which every host reports as its own node's value. #[derive(crate::contract::Component, crate::contract::Props)] #[component(sample = SelectFace::sample)] pub struct SelectFace<'a> { @@ -71,7 +72,7 @@ pub struct SelectFace<'a> { #[prop(into)] thumb_caption: Option