Capture · Roots: roots drop w_full; hosts give the width

145 component roots drop w_full, the early returns included. Three
field rows keep it, Input, InputGroup and TagInput: stretched without
a width, taffy 0.9 laid the field's flex_1 share at no width in the
template picker at 280px, and the placeholder drew nothing. Container
keeps it, since mx_auto needs a width to fill.

Hosts that relied on a root's width now give it: MessageList boxes
each row at the list's width, the splash gives its bar the column's,
and test stages that mount a component as the window's root sit in a
size_full box. Tests hold a narrow row across the list and the splash
bar across its column; each goes red without its fix.

The gallery gains --narrow <px>, which lays each page in a padded
card at that width and shoots it without its script. The page
header wraps: the title takes the room and the theme switcher drops
below, where a long summary used to push it past the edge. A file
panel step waits for the panel to become key instead of a fixed
pause, which lost a race in a capture.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-28 13:07:22 -04:00
1 parent 3be809a660
commit 81e73b79c1
126 files changed
+275 -276

No files matched your search

+28 -1
View File
@@ -13,7 +13,8 @@ mod history;
mod welcome;
use super::{
ImageMessage, MessageAvatar, MessageBubble, MessageEditor, MessageList, Role, ThinkingBlock,
DateSeparator, ImageMessage, MessageAvatar, MessageBubble, MessageEditor, MessageList, Role,
ThinkingBlock,
};
use crate::{forms, forms::TextInput, theme::Theme};
@@ -361,3 +362,29 @@ fn the_reasoning_opens_from_the_keyboard(cx: &mut TestAppContext) {
"Tab and Space open it: {closed:?} to {open:?}"
);
}
struct Dated;
impl Render for Dated {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
let day = jiff::civil::date(2026, 9, 28);
div()
.size_full()
.child(MessageList::new("dated", 1, move |_, _, _| {
DateSeparator::new(day, day).into_any_element()
}))
}
}
/// A row no wider than its words still spans the list.
#[gpui::test]
fn a_narrow_row_spans_the_list(cx: &mut TestAppContext) {
cx.update(Theme::init);
let (_, cx) = cx.add_window_view(|_, _| Dated);
settle(cx);
let row = cx
.debug_bounds("date-separator-Today")
.expect("the separator draws");
let width = cx.update(|window, _| window.viewport_size().width);
assert_eq!(row.size.width, width);
}