From bf8f3e3d68567e5bfde0ee89b6ddd21c483452e1 Mon Sep 17 00:00:00 2001 From: Julia Date: Thu, 4 Jan 2024 15:07:46 -0500 Subject: [PATCH] Unbork test relying on old keystroke behavior Previously it would both send the keydown *and then* the action, now it send the action, and then because there was an action, does not send the keydown Co-Authored-By: Conrad Irwin --- crates/gpui/src/interactive.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/interactive.rs b/crates/gpui/src/interactive.rs index 6fc7cfc8e8..0be917350d 100644 --- a/crates/gpui/src/interactive.rs +++ b/crates/gpui/src/interactive.rs @@ -307,7 +307,10 @@ mod test { div().id("testview").child( div() .key_context("parent") - .on_key_down(cx.listener(|this, _, _| this.saw_key_down = true)) + .on_key_down(cx.listener(|this, _, cx| { + cx.stop_propagation(); + this.saw_key_down = true + })) .on_action( cx.listener(|this: &mut TestView, _: &TestAction, _| { this.saw_action = true @@ -343,6 +346,7 @@ mod test { .update(cx, |test_view, cx| cx.focus(&test_view.focus_handle)) .unwrap(); + cx.dispatch_keystroke(*window, Keystroke::parse("a").unwrap(), false); cx.dispatch_keystroke(*window, Keystroke::parse("ctrl-g").unwrap(), false); window