mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-10 04:27:40 +00:00
Save item when closing it if autosave on focus change is enabled
This commit is contained in:
parent
5e00df6267
commit
9286893177
1 changed files with 8 additions and 2 deletions
|
@ -14,7 +14,7 @@ use gpui::{
|
|||
};
|
||||
use project::{Project, ProjectEntryId, ProjectPath};
|
||||
use serde::Deserialize;
|
||||
use settings::Settings;
|
||||
use settings::{Autosave, Settings};
|
||||
use std::{any::Any, cell::RefCell, mem, path::Path, rc::Rc};
|
||||
use util::ResultExt;
|
||||
|
||||
|
@ -677,7 +677,13 @@ impl Pane {
|
|||
_ => return Ok(false),
|
||||
}
|
||||
} else if is_dirty && (can_save || is_singleton) {
|
||||
let should_save = if should_prompt_for_save {
|
||||
let autosave_enabled = cx.read(|cx| {
|
||||
matches!(
|
||||
cx.global::<Settings>().autosave,
|
||||
Autosave::OnFocusChange | Autosave::OnWindowChange
|
||||
)
|
||||
});
|
||||
let should_save = if should_prompt_for_save && !autosave_enabled {
|
||||
let mut answer = pane.update(cx, |pane, cx| {
|
||||
pane.activate_item(item_ix, true, true, cx);
|
||||
cx.prompt(
|
||||
|
|
Loading…
Reference in a new issue