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

+7 -1
View File
@@ -247,7 +247,13 @@ pub(crate) fn listen<E: InteractiveElement>(root: E, cx: &mut Context<CodeEditor
e.delete_by(|buffer, at| buffer.word_start(at)..at, cx)
});
let root = on!(root, DeleteLineLeft, |e, _, cx| e.delete_by(line_left, cx));
let root = on!(root, Newline, |e, _, cx| e.newline(cx));
let root = on!(root, Newline, |e, window, cx| {
if e.focus.is_focused(window) {
e.newline(cx)
} else {
cx.propagate()
}
});
let root = on!(root, Indent, |e, _, cx| e.indent(cx));
let root = on!(root, Outdent, |e, _, cx| e.outdent(cx));
let root = on!(root, Undo, |e, _, cx| e.undo(cx));
+1 -1
View File
@@ -352,7 +352,7 @@ impl CodeEditor {
window: &mut Window,
cx: &mut Context<Self>,
) {
window.focus(&self.focus);
window.focus(&self.focus, cx);
let at = self.offset_in(line, event.position.x, cx);
let chosen = match event.click_count {
2 => {
+2 -2
View File
@@ -397,9 +397,9 @@ impl CodeEditor {
self.marks.chat = line;
if line.is_some() {
let focus = self.chat_field.read(cx).focus().clone();
window.focus(&focus);
window.focus(&focus, cx);
} else {
window.focus(&self.focus);
window.focus(&self.focus, cx);
cx.emit(EditorEvent::ChatClosed);
}
cx.notify();
+24 -1
View File
@@ -1,6 +1,6 @@
use std::time::Duration;
use gpui::{Entity, EntityInputHandler, TestAppContext, VisualTestContext};
use gpui::{Entity, EntityInputHandler, KeyUpEvent, Keystroke, TestAppContext, VisualTestContext};
use super::{CodeEditor, GhostText, InlayHint, LineNumbers, layout::Row};
use crate::theme::Theme;
@@ -140,6 +140,29 @@ fn a_read_only_editor_ignores_typing_and_undo(cx: &mut TestAppContext) {
});
}
#[gpui::test]
fn enter_presses_the_banner_button_inside_the_editor(cx: &mut TestAppContext) {
let (editor, cx) = editor("x", cx);
cx.update(|window, cx| {
super::keys::bind_keys(cx);
editor.update(cx, |editor, cx| editor.set_read_only(true, cx));
window.refresh();
});
cx.run_until_parked();
let focus = editor.read_with(cx, |editor, _| editor.focus.clone());
cx.update(|window, cx| {
window.focus(&focus, cx);
window.focus_next(cx);
});
cx.run_until_parked();
cx.simulate_keystrokes("enter");
cx.simulate_event(KeyUpEvent {
keystroke: Keystroke::parse("enter").expect("a key"),
});
cx.run_until_parked();
assert!(!editor.read_with(cx, |editor, _| editor.is_read_only()));
}
#[gpui::test]
fn a_hint_past_a_multi_line_ghost_stays_in_its_row(cx: &mut TestAppContext) {
let (editor, cx) = editor("call(x)\nnext", cx);
+1 -1
View File
@@ -268,7 +268,7 @@ impl Render for CodeEditor {
range.map(|ix| editor.row(ix, window, cx)).collect()
}),
)
.track_scroll(self.scroll.clone())
.track_scroll(&self.scroll)
.size_full();
let (top, focus, input) = (cx.entity(), self.focus.clone(), cx.entity());
let unlock = cx.entity();