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

@ -867,12 +867,15 @@ mod tests {
// Go forward to an item that has been closed, ensuring it gets re-opened at the same
// location.
workspace.update(cx, |workspace, cx| {
workspace
.active_pane()
.update(cx, |pane, cx| pane.close_item(editor3.id(), cx));
drop(editor3);
});
workspace
.update(cx, |workspace, cx| {
let editor3_id = editor3.id();
drop(editor3);
workspace
.active_pane()
.update(cx, |pane, cx| pane.close_item(editor3_id, cx))
})
.await;
workspace
.update(cx, |w, cx| Pane::go_forward(w, None, cx))
.await;
@ -884,15 +887,17 @@ mod tests {
// Go back to an item that has been closed and removed from disk, ensuring it gets skipped.
workspace
.update(cx, |workspace, cx| {
let editor2_id = editor2.id();
drop(editor2);
workspace
.active_pane()
.update(cx, |pane, cx| pane.close_item(editor2.id(), cx));
drop(editor2);
app_state
.fs
.as_fake()
.remove_file(Path::new("/root/a/file2"), Default::default())
.update(cx, |pane, cx| pane.close_item(editor2_id, cx))
})
.await;
app_state
.fs
.as_fake()
.remove_file(Path::new("/root/a/file2"), Default::default())
.await
.unwrap();
workspace