Prompt before closing buffer with unsaved changes or conflicts

This commit is contained in:
Antonio Scandurra 2022-04-01 14:32:41 +02:00
parent 703f1c3be0
commit e93ab4db14
3 changed files with 306 additions and 63 deletions

View file

@ -497,7 +497,8 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
}
if T::should_close_item_on_event(event) {
pane.update(cx, |pane, cx| pane.close_item(item.id(), cx));
pane.update(cx, |pane, cx| pane.close_item(item.id(), cx))
.detach();
return;
}
@ -737,7 +738,7 @@ impl Workspace {
})
.detach();
let pane = cx.add_view(|cx| Pane::new(cx));
let pane = cx.add_view(|cx| Pane::new(params.project.clone(), cx));
let pane_id = pane.id();
cx.observe(&pane, move |me, _, cx| {
let active_entry = me.active_project_path(cx);
@ -1069,7 +1070,7 @@ impl Workspace {
}
fn add_pane(&mut self, cx: &mut ViewContext<Self>) -> ViewHandle<Pane> {
let pane = cx.add_view(|cx| Pane::new(cx));
let pane = cx.add_view(|cx| Pane::new(self.project.clone(), cx));
let pane_id = pane.id();
cx.observe(&pane, move |me, _, cx| {
let active_entry = me.active_project_path(cx);