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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
486f618ecc
commit
5779daef82
126 files changed
+275
-276
No files matched your search
@@ -12,12 +12,28 @@ fn open(
|
||||
forms::bind_keys(cx);
|
||||
crate::documents::bind_keys(cx);
|
||||
});
|
||||
let (editor, cx) = cx.add_window_view(|window, cx| BlockEditor::new(blocks, window, cx));
|
||||
let (full, cx) =
|
||||
cx.add_window_view(|window, cx| Full(cx.new(|cx| BlockEditor::new(blocks, window, cx))));
|
||||
let editor = full.read_with(cx, |full, _| full.0.clone());
|
||||
cx.update(|window, _| window.activate_window());
|
||||
settle(cx);
|
||||
(editor, cx)
|
||||
}
|
||||
|
||||
/// The editor as a window's content, in the box that fills the window.
|
||||
struct Full(Entity<BlockEditor>);
|
||||
|
||||
impl gpui::Render for Full {
|
||||
fn render(
|
||||
&mut self,
|
||||
_: &mut gpui::Window,
|
||||
_: &mut gpui::Context<Self>,
|
||||
) -> impl gpui::IntoElement {
|
||||
use gpui::{ParentElement, Styled};
|
||||
gpui::div().size_full().child(self.0.clone())
|
||||
}
|
||||
}
|
||||
|
||||
fn settle(cx: &mut VisualTestContext) {
|
||||
cx.run_until_parked();
|
||||
cx.update(|window, _| window.refresh());
|
||||
|
||||
@@ -253,7 +253,6 @@ impl Render for BlockEditor {
|
||||
let start = cx.entity();
|
||||
div()
|
||||
.id(id.clone())
|
||||
.w_full()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.capture_action(cx.listener(|editor, _: &Undo, window, cx| {
|
||||
|
||||
@@ -108,7 +108,6 @@ impl RenderOnce for PageCover {
|
||||
.id(self.id.clone())
|
||||
.group(group.clone())
|
||||
.relative()
|
||||
.w_full()
|
||||
.h(theme.page_cover())
|
||||
.child(
|
||||
Image::new((self.id.clone(), "picture"), source(&self.source))
|
||||
|
||||
+16
-20
@@ -208,27 +208,23 @@ impl RenderOnce for ReadingProgress {
|
||||
let theme = cx.theme();
|
||||
let (track, bar) = (theme.colors.border, theme.colors.accent);
|
||||
let scroll = self.scroll;
|
||||
div()
|
||||
.w_full()
|
||||
.h(theme.progress_thickness())
|
||||
.bg(track)
|
||||
.child(
|
||||
canvas(
|
||||
|_, _, _| {},
|
||||
move |bounds, _, window, _| {
|
||||
let share = read_share(
|
||||
f32::from(scroll.offset().y),
|
||||
f32::from(scroll.max_offset().height),
|
||||
);
|
||||
let filled = Bounds::new(
|
||||
bounds.origin,
|
||||
size(bounds.size.width * share, bounds.size.height),
|
||||
);
|
||||
window.paint_quad(fill(filled, bar));
|
||||
},
|
||||
)
|
||||
.size_full(),
|
||||
div().h(theme.progress_thickness()).bg(track).child(
|
||||
canvas(
|
||||
|_, _, _| {},
|
||||
move |bounds, _, window, _| {
|
||||
let share = read_share(
|
||||
f32::from(scroll.offset().y),
|
||||
f32::from(scroll.max_offset().height),
|
||||
);
|
||||
let filled = Bounds::new(
|
||||
bounds.origin,
|
||||
size(bounds.size.width * share, bounds.size.height),
|
||||
);
|
||||
window.paint_quad(fill(filled, bar));
|
||||
},
|
||||
)
|
||||
.size_full(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user