Implement 'Cmd+W with no open tabs closes the window', with a setting (#11989)
Follow up to: https://github.com/zed-industries/zed/pull/10986 However, I have set this to have a default behavior of 'auto': matching the current platform's conventions, rather than a default value of 'off'. fixes https://github.com/zed-industries/zed/issues/5322. Release Notes: - Changed the behavior of `workspace::CloseActiveItem`: when you're using macOS and there are no open tabs, it now closes the window ([#5322](https://github.com/zed-industries/zed/issues/5322)). This can be controlled with a new setting, `when_closing_with_no_tabs`, to disable it on macOS, or enable it on other platforms.
This commit is contained in:
parent
7fd736e23c
commit
11c97a396e
3 changed files with 45 additions and 1 deletions
|
@ -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;
|
||||
|
@ -948,6 +948,14 @@ impl Pane {
|
|||
cx: &mut ViewContext<Self>,
|
||||
) -> Option<Task<Result<()>>> {
|
||||
if self.items.is_empty() {
|
||||
// Close the window when there's no active items to close, if configured
|
||||
if WorkspaceSettings::get_global(cx)
|
||||
.when_closing_with_no_tabs
|
||||
.should_close()
|
||||
{
|
||||
cx.dispatch_action(Box::new(CloseWindow));
|
||||
}
|
||||
|
||||
return None;
|
||||
}
|
||||
let active_item_id = self.items[self.active_item_index].item_id();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue