From afa0903120ca34887a62dc314d3a559e9285d1ac Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 9 May 2024 14:04:16 -0600 Subject: [PATCH] On escape, close context menus before clearing selection --- src/app.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app.rs b/src/app.rs index 5305a53..058358c 100644 --- a/src/app.rs +++ b/src/app.rs @@ -948,7 +948,10 @@ impl Application for App { // Why: It'd be weird to close everything all at once // Usually, the Escape key (for example) closes menus and panes one by one instead // of closing everything on one press - // TODO: Close MenuBar too + if self.core.window.show_context { + self.core.window.show_context = false; + return Command::none(); + } if let Some(tab) = self.tab_model.data_mut::(entity) { if tab.context_menu.is_some() { tab.context_menu = None; @@ -964,7 +967,6 @@ impl Application for App { return Command::none(); } } - self.core.window.show_context = false; Command::none() }