From a12b8c8bd88d4fce9fbf30346df4c5cb5cf01617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 10 Jul 2026 16:35:53 -0400 Subject: [PATCH] fix(command): close the command overlay on Escape --- crates/ely_app/src/shell/focus.rs | 12 ++++++++++++ crates/ely_app/src/shell/render.rs | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/crates/ely_app/src/shell/focus.rs b/crates/ely_app/src/shell/focus.rs index 0b1d26d..5c99a33 100644 --- a/crates/ely_app/src/shell/focus.rs +++ b/crates/ely_app/src/shell/focus.rs @@ -15,6 +15,18 @@ impl ElyShell { }); } } + + /// Close the command overlay (Escape or a backdrop click): drop the + /// `>` query that drives its visibility, reset the selection, and put + /// the active tab's address back in the omnibar. + pub(super) fn exit_command_mode(&mut self, window: &mut Window, cx: &mut Context) { + if let ShellState::Ready(core) = &mut self.state { + core.set_command_query(""); + } + self.command_selected_index = 0; + self.sync_address_input(window, cx); + cx.notify(); + } } impl Focusable for ElyShell { diff --git a/crates/ely_app/src/shell/render.rs b/crates/ely_app/src/shell/render.rs index cd3fb52..ca26f4d 100644 --- a/crates/ely_app/src/shell/render.rs +++ b/crates/ely_app/src/shell/render.rs @@ -259,6 +259,11 @@ impl ElyShell { cx: &mut Context, ) { let key = event.keystroke.key.as_str(); + if key == "escape" { + self.exit_command_mode(window, cx); + cx.stop_propagation(); + return; + } if !matches!(key, "up" | "down" | "enter") { return; }