From 5102e37a5bc344cb1f5f2a4116b55d4d3afafbb0 Mon Sep 17 00:00:00 2001 From: William Viktorsson Date: Fri, 19 Apr 2024 23:42:33 +0200 Subject: [PATCH] Changed cmd+w with no open tabs to close window (#10740) Fixes https://github.com/zed-industries/zed/issues/5322 Release Notes: - Changed cmd+w with no open tabs to close window [#5322](https://github.com/zed-industries/zed/issues/5322) https://github.com/zed-industries/zed/assets/22855292/113b1635-ae30-4718-a3d3-758a4bf53714 --- crates/workspace/src/pane.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index bf32f7c0c24fa7ebaaa6d5143c7a14d805753329..58b1d10aa0a4984b97a0f9a610a01db383c9b967 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -5,7 +5,7 @@ use crate::{ }, toolbar::Toolbar, workspace_settings::{AutosaveSetting, TabBarSettings, WorkspaceSettings}, - NewCenterTerminal, NewFile, NewSearch, OpenInTerminal, OpenTerminal, OpenVisible, + CloseWindow, NewCenterTerminal, NewFile, NewSearch, OpenInTerminal, OpenTerminal, OpenVisible, SplitDirection, ToggleZoom, Workspace, }; use anyhow::Result; @@ -874,6 +874,8 @@ impl Pane { cx: &mut ViewContext, ) -> Option>> { if self.items.is_empty() { + // Close the window when there's no active items to close. + cx.dispatch_action(Box::new(CloseWindow)); return None; } let active_item_id = self.items[self.active_item_index].item_id();