Read Cmd/Ctrl+W before the comment field draws, and leave it to a comment being typed

This commit is contained in:
bflatastic committed 2026-11-29 21:48:00 +07:00
1 parent 5e9c7f6ea4
commit bfa5bc998d
1 file changed
+3 -2
+3 -2
View File
@@ -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);