Option to auto-close deleted files with no unsaved edits (#31920)
Closes #27982 Release Notes: - Added `close_on_file_delete` setting (off by default) to allow closing open files after they have been deleted on disk --------- Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This commit is contained in:
parent
3077abf9cf
commit
b74477d12e
6 changed files with 393 additions and 5 deletions
|
@ -11,7 +11,7 @@ use gpui::{
|
|||
InteractiveElement, IntoElement, ObjectFit, ParentElement, Render, Styled, Task, WeakEntity,
|
||||
Window, canvas, div, fill, img, opaque_grey, point, size,
|
||||
};
|
||||
use language::File as _;
|
||||
use language::{DiskState, File as _};
|
||||
use persistence::IMAGE_VIEWER;
|
||||
use project::{ImageItem, Project, ProjectPath, image_store::ImageItemEvent};
|
||||
use settings::Settings;
|
||||
|
@ -191,6 +191,10 @@ impl Item for ImageView {
|
|||
focus_handle: cx.focus_handle(),
|
||||
}))
|
||||
}
|
||||
|
||||
fn has_deleted_file(&self, cx: &App) -> bool {
|
||||
self.image_item.read(cx).file.disk_state() == DiskState::Deleted
|
||||
}
|
||||
}
|
||||
|
||||
fn breadcrumbs_text_for_image(project: &Project, image: &ImageItem, cx: &App) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue