From bfa5bc998dc4b0ffc7a3668efb3601fca28001d6 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 29 Nov 2026 21:48:00 +0700 Subject: [PATCH] Read Cmd/Ctrl+W before the comment field draws, and leave it to a comment being typed --- crates/ui-egui/src/present/chrome.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/present/chrome.rs b/crates/ui-egui/src/present/chrome.rs index d1f0f621a..6c0c2f4cb 100644 --- a/crates/ui-egui/src/present/chrome.rs +++ b/crates/ui-egui/src/present/chrome.rs @@ -55,6 +55,9 @@ pub fn show(app: &mut FigApp, ui: &mut Ui) { if !typing && ctx.input_mut(|i| i.consume_key(egui::Modifiers::SHIFT, egui::Key::C)) { action = Some(BarAction::Comments); } + // Cmd/Ctrl+W closes the tab in front, a presentation tab as well as a file tab; read before + // anything draws, and left to a comment being typed. + let close_key = !typing && ctx.input_mut(|i| i.consume_key(egui::Modifiers::COMMAND, egui::Key::W)); // Cmd/Ctrl+\ hides and shows the bars, as it hides and shows the editor's UI. if !typing && ctx.input_mut(|i| i.consume_key(egui::Modifiers::COMMAND, egui::Key::Backslash)) { action = Some(BarAction::HideUi); @@ -125,8 +128,6 @@ pub fn show(app: &mut FigApp, ui: &mut Ui) { choose_device(app, &mut pres, &device); } app.ui.present = Some(pres); - // Cmd/Ctrl+W closes the tab in front, a presentation tab as well as a file tab. - let close_key = ctx.input_mut(|i| i.consume_key(egui::Modifiers::COMMAND, egui::Key::W)); if action == Some(BarAction::Close) || close_key || ctx.input(|i| i.key_pressed(egui::Key::Escape)) { if let Some(id) = app.ui.present_active { crate::tabs::close_present(app, id);