From deb77f91d8bd9e18773423eb3daecd259bb8063c Mon Sep 17 00:00:00 2001 From: Hayyaun Date: Mon, 23 Nov 2026 17:59:01 +0330 Subject: [PATCH] Revert "Merge upstream PR #2556: fix(present): close the active tab with Cmd/Ctrl+W" This reverts commit 8f5c9c2e2ea29e70e44946e17d4002881b1f6b09, reversing changes made to d05c13e44b7d02418969ec73efa112910e5a0e96. --- crates/ui-egui/src/present/chrome.rs | 13 ++----------- crates/ui-egui/src/present_tab_tests.rs | 15 --------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/crates/ui-egui/src/present/chrome.rs b/crates/ui-egui/src/present/chrome.rs index b11e0b4fa..d29fd40e2 100644 --- a/crates/ui-egui/src/present/chrome.rs +++ b/crates/ui-egui/src/present/chrome.rs @@ -36,7 +36,7 @@ pub struct PresentTab { pub page_name: String, } -/// The full-window presenter (while `app.ui.present` is set). Escape, Cmd/Ctrl+W or Close ends it. +/// The full-window presenter (while `app.ui.present` is set). Escape or Close ends it. pub fn show(app: &mut FigApp, ui: &mut Ui) { let ctx = ui.ctx().clone(); let now = ctx.input(|i| i.time); @@ -48,15 +48,6 @@ pub fn show(app: &mut FigApp, ui: &mut Ui) { pres.sync(&ds.doc, now); } poll_pads(app, &mut pres, &ctx); - // Reserve Cmd/Ctrl+W before the prototype handles key bindings. - let close_shortcut = ctx.input_mut(|i| { - let count = i.events.len(); - i.events.retain(|event| { - !matches!(event, egui::Event::Key { key: egui::Key::W, pressed: true, modifiers, .. } - if modifiers.matches_exact(egui::Modifiers::COMMAND)) - }); - i.events.len() != count - }); let mut action = None; // Typing a reply to a comment keeps the keys from the prototype, and so does the link notice // while it shows; Shift+C shows the comments. @@ -134,7 +125,7 @@ pub fn show(app: &mut FigApp, ui: &mut Ui) { choose_device(app, &mut pres, &device); } app.ui.present = Some(pres); - if action == Some(BarAction::Close) || close_shortcut || ctx.input(|i| i.key_pressed(egui::Key::Escape)) { + if action == Some(BarAction::Close) || ctx.input(|i| i.key_pressed(egui::Key::Escape)) { if let Some(id) = app.ui.present_active { crate::tabs::close_present(app, id); } else { diff --git a/crates/ui-egui/src/present_tab_tests.rs b/crates/ui-egui/src/present_tab_tests.rs index 5c2dc4174..1868babb6 100644 --- a/crates/ui-egui/src/present_tab_tests.rs +++ b/crates/ui-egui/src/present_tab_tests.rs @@ -86,21 +86,6 @@ fn the_tab_is_named_after_the_file_and_page_and_its_x_closes_it() { assert!(!u.app.ui.home, "back to its file"); } -#[test] -fn command_w_closes_the_present_tab() { - let (mut u, a, ..) = setup(); - u.run("proto.present", json!({"start": a})); - assert!(presenting(&u)); - let key = |pressed, modifiers| egui::Event::Key { key: Key::W, physical_key: None, pressed, repeat: false, modifiers }; - let shifted = egui::Modifiers::COMMAND | egui::Modifiers::SHIFT; - u.frame(vec![key(true, shifted), key(false, shifted)]); - assert!(presenting(&u)); - let command = egui::Modifiers::COMMAND; - u.frame(vec![key(true, command), key(false, command)]); - assert_eq!((presenting(&u), tabs(&u)), (false, json!([]))); - assert!(!u.app.ui.home, "back to its file"); -} - #[test] fn play_again_shows_the_tab_as_it_was_and_another_page_opens_a_new_one() { let (mut u, a, b, _) = setup();