Port · Calendar: a real exit clears the preview after a key

The calendar's grid clears its preview on leave, and ignores a leave
that follows a key. gpui records the exit a key makes before the
handler runs, so the guard swallowed it and a real exit afterwards
had no change left to report: the stale day stayed the preview. The
grid now listens independently of input, while its days keep the
default, so a key is no leave and a real exit is. A test leaves the
grid after an arrow, a letter and a month key.

shaped()'s doc goes back to its one line; AGENTS.md keeps the why.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-28 20:54:25 -04:00
1 parent 4c3ed1bbb9
commit 05bd22b7f0
5 files changed
+28 -5

No files matched your search

+21
View File
@@ -236,3 +236,24 @@ fn keys_keep_the_preview_under_a_resting_pointer(cx: &mut TestAppContext) {
"the keyboard's day stays the preview"
);
}
#[gpui::test]
fn leaving_the_grid_after_a_key_clears_the_preview(cx: &mut TestAppContext) {
setup(cx);
for key in ["right", "a", "pagedown"] {
let (view, cx) = cx.add_window_view(|_, _| Watched { seen: Vec::new() });
cx.update(|window, cx| window.focus_next(cx));
cx.simulate_mouse_move(point(px(120.0), px(200.0)), None, Modifiers::none());
cx.simulate_keystrokes(key);
cx.update(|window, _| window.refresh());
cx.run_until_parked();
cx.simulate_mouse_move(point(px(700.0), px(480.0)), None, Modifiers::none());
cx.update(|window, _| window.refresh());
cx.run_until_parked();
assert_eq!(
view.read_with(cx, |view, _| view.seen.last().copied().flatten()),
None,
"after {key}, leaving the grid clears its preview"
);
}
}