From 27d28c930fdee2d463669c1370aa3832254faf34 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 9 Aug 2023 13:50:21 -0700 Subject: [PATCH] Restore shutdown behavior (#2837) Deals with https://github.com/zed-industries/community/issues/1898 Restores original close behavior from https://github.com/zed-industries/zed/pull/2832/files#diff-89af0b4072205c53b518aa977d6be48997e1a51fa4dbf06c7ddd1fec99fc510eL444 (load diff for the last file, zed.rs) and adds a better name for the variable. Release Notes: - Fixes `cmd-q` not working --- crates/workspace/src/workspace.rs | 4 ++-- crates/zed/src/zed.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 2f884b0ceb33d10e598057a65e1c44a60471227e..1612aadc2f54c682ad17596d91a41ed2ee7f523d 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -4067,10 +4067,10 @@ pub fn restart(_: &Restart, cx: &mut AppContext) { // If the user cancels any save prompt, then keep the app open. for window in workspace_windows { - if let Some(close) = window.update_root(&mut cx, |workspace, cx| { + if let Some(should_close) = window.update_root(&mut cx, |workspace, cx| { workspace.prepare_to_close(true, cx) }) { - if !close.await? { + if !should_close.await? { return Ok(()); } } diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 099d837ba4c703825b10d2191261deebab5f7089..f27a6f075d2438a3bf6030998df23c9e7dea0535 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -433,10 +433,10 @@ fn quit(_: &Quit, cx: &mut gpui::AppContext) { // If the user cancels any save prompt, then keep the app open. for window in workspace_windows { - if let Some(close) = window.update_root(&mut cx, |workspace, cx| { - workspace.prepare_to_close(false, cx) + if let Some(should_close) = window.update_root(&mut cx, |workspace, cx| { + workspace.prepare_to_close(true, cx) }) { - if close.await? { + if !should_close.await? { return Ok(()); } }