Port · Build: Zed's gpui at 1a28cff

gpui and gpui_platform now come from Zed's repo by git at 1a28cff,
the code gpui-pre 0.3.7 republishes, so the gallery can later build
for the browser. gpui takes stacker, as 0.2.2 always did, and
gpui_platform takes font-kit, without which macOS draws no text;
runtime_shaders moves to gpui_platform.

The API moved: focus, blur and Tab steps take cx, Corner is Anchor,
shaped lines paint with an alignment, defer_draw takes a content
mask, the inspector registers a factory, async updates return their
value, and wrapped lines are shared, not cloned. Updates through a
window context go through the window, so a closed window still ends
them as it did.

Where the new gpui behaves differently, Ely keeps its old intent.
Holds and reveals under a resting pointer survive typing through
gpui's input-modality-independent hover; previews the keyboard also
moves keep the default, and the calendar's leave ignores a key press.
Enter reaches a button inside the code editor, since gpui now arms a
key click on the press. The event logger skips a lone modifier. A
video and an image grid keep their shape in a flex column under
taffy 0.13, as a picture does.

AGENTS.md records the new stack and the rules this port changes; the
rest of the old gpui and taffy rules are re-tested in T44c.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-28 20:30:17 -04:00
1 parent 25b8a6f22c
commit 4c3ed1bbb9
199 files changed
+2513 -2643

No files matched your search

+4 -4
View File
@@ -78,7 +78,7 @@ fn citations_and_sources_open_from_the_keyboard(cx: &mut TestAppContext) {
});
cx.update(|window, _| window.activate_window());
settle(cx);
cx.update(|window, _| window.focus_next());
cx.update(|window, cx| window.focus_next(cx));
release("enter", cx);
assert_eq!(
cited.read_with(cx, |cited, _| cited.opened),
@@ -86,7 +86,7 @@ fn citations_and_sources_open_from_the_keyboard(cx: &mut TestAppContext) {
"the badge opens its source"
);
let folded = frame.borrow().expect("the list is laid out").size.height;
cx.update(|window, _| window.focus_next());
cx.update(|window, cx| window.focus_next(cx));
release("space", cx);
let open = frame.borrow().expect("the list is laid out").size.height;
assert!(
@@ -126,9 +126,9 @@ fn cards_open_from_the_keyboard(cx: &mut TestAppContext) {
let (cards, cx) = cx.add_window_view(|_, _| Cards { opened: Vec::new() });
cx.update(|window, _| window.activate_window());
settle(cx);
cx.update(|window, _| window.focus_next());
cx.update(|window, cx| window.focus_next(cx));
release("enter", cx);
cx.update(|window, _| window.focus_next());
cx.update(|window, cx| window.focus_next(cx));
release("enter", cx);
assert_eq!(
cards.read_with(cx, |cards, _| cards.opened.clone()),
+1 -1
View File
@@ -67,7 +67,7 @@ fn open(
cx.update(|window, cx| {
window.activate_window();
let field = compose.read(cx).field.focus_handle(cx);
window.focus(&field);
window.focus(&field, cx);
});
settle(cx);
(compose, cx)
+2 -2
View File
@@ -67,9 +67,9 @@ fn a_rows_actions_open_from_the_keyboard(cx: &mut TestAppContext) {
let (row, cx) = row(cx);
cx.simulate_mouse_move(point(px(10.0), px(200.0)), None, Modifiers::none());
settle(cx);
cx.update(|window, _| window.focus_next());
cx.update(|window, cx| window.focus_next(cx));
settle(cx);
cx.update(|window, _| window.focus_next());
cx.update(|window, cx| window.focus_next(cx));
settle(cx);
press("enter", cx);
press("enter", cx);
+66 -9
View File
@@ -1,10 +1,10 @@
use std::{cell::RefCell, rc::Rc};
use std::{cell::RefCell, rc::Rc, time::Duration};
use gpui::{
AppContext as _, Bounds, Context, Entity, Focusable, InteractiveElement, IntoElement,
KeyUpEvent, Keystroke, Modifiers, MouseButton, ParentElement, Pixels, Render, ScrollDelta,
ScrollWheelEvent, Styled, TestAppContext, TouchPhase, VisualTestContext, Window, canvas, div,
point, px,
AnyElement, AppContext as _, Bounds, Context, Entity, Focusable, InteractiveElement,
IntoElement, KeyUpEvent, Keystroke, Modifiers, MouseButton, ParentElement, Pixels, Render,
ScrollDelta, ScrollWheelEvent, Styled, TestAppContext, TouchPhase, VisualTestContext, Window,
canvas, div, point, px,
};
mod cite;
@@ -13,8 +13,8 @@ mod history;
mod welcome;
use super::{
DateSeparator, ImageMessage, MessageAvatar, MessageBubble, MessageEditor, MessageList, Role,
ThinkingBlock,
DateSeparator, ImageGrid, ImageMessage, MessageAvatar, MessageBubble, MessageEditor,
MessageList, Role, ThinkingBlock, VideoMessage,
};
use crate::{forms, forms::TextInput, theme::Theme};
@@ -139,7 +139,7 @@ fn an_edit_saves_only_a_change_and_escape_cancels(cx: &mut TestAppContext) {
cx.update(|window, cx| {
window.activate_window();
let field = edit.read(cx).field.focus_handle(cx);
window.focus(&field);
window.focus(&field, cx);
});
settle(cx);
cx.simulate_keystrokes("cmd-enter");
@@ -306,6 +306,63 @@ fn a_picture_fits_a_narrow_column_in_its_own_shape(cx: &mut TestAppContext) {
assert_eq!(bounds.size.height, px(160.0), "240 wide at 3:2 is 160 tall");
}
/// A message in a narrow flex column, the column measured.
struct Column {
frame: Measured,
message: fn() -> AnyElement,
}
impl Render for Column {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
let frame = self.frame.clone();
div().size_full().child(
div()
.w(px(240.0))
.relative()
.flex()
.flex_col()
.child((self.message)())
.child(
canvas(
move |bounds, _, _| *frame.borrow_mut() = Some(bounds),
|_, _, _, _| {},
)
.absolute()
.top_0()
.left_0()
.size_full(),
),
)
}
}
fn column_height(message: fn() -> AnyElement, cx: &mut TestAppContext) -> Pixels {
let frame = Measured::default();
let seen = frame.clone();
let (_, cx) = cx.add_window_view(move |_, _| Column {
frame: seen,
message,
});
settle(cx);
frame.borrow().expect("the column is laid out").size.height
}
#[gpui::test]
fn a_video_and_a_grid_fit_a_narrow_flex_column_in_their_shape(cx: &mut TestAppContext) {
cx.update(Theme::init);
let video = || {
VideoMessage::new("video", "dunes.jpg", 960.0, 640.0, Duration::from_secs(84))
.into_any_element()
};
assert_eq!(column_height(video, cx), px(160.0), "240 wide at 3:2");
let grid = || ImageGrid::new("grid", ["a.jpg", "b.jpg"]).into_any_element();
assert_eq!(
column_height(grid, cx),
px(120.0),
"two side by side at 2:1"
);
}
/// Reasoning folded under its time, the block's box measured.
struct Reasoning {
frame: Measured,
@@ -350,7 +407,7 @@ fn the_reasoning_opens_from_the_keyboard(cx: &mut TestAppContext) {
cx.update(|window, _| window.activate_window());
settle(cx);
let closed = frame.borrow().expect("the block is laid out").size.height;
cx.update(|window, _| window.focus_next());
cx.update(|window, cx| window.focus_next(cx));
cx.simulate_keystrokes("space");
cx.simulate_event(KeyUpEvent {
keystroke: Keystroke::parse("space").expect("space parses"),