editor: Save base buffers when applying changes from their branches (#19562)
This PR makes it so that when we apply changes within a branch buffer—currently just the edits buffer—we save the underlying buffer. This also fixes an issue where new files created via edits were not properly flushed to disk. Release Notes: - N/A --------- Co-authored-by: Max <max@zed.dev>
This commit is contained in:
parent
d8d84bf5d4
commit
5dbf68ddc4
4 changed files with 67 additions and 30 deletions
|
@ -298,6 +298,20 @@ impl Item for ProposedChangesEditor {
|
|||
Item::set_nav_history(editor, nav_history, cx)
|
||||
});
|
||||
}
|
||||
|
||||
fn can_save(&self, cx: &AppContext) -> bool {
|
||||
self.editor.read(cx).can_save(cx)
|
||||
}
|
||||
|
||||
fn save(
|
||||
&mut self,
|
||||
format: bool,
|
||||
project: Model<Project>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Task<gpui::Result<()>> {
|
||||
self.editor
|
||||
.update(cx, |editor, cx| Item::save(editor, format, project, cx))
|
||||
}
|
||||
}
|
||||
|
||||
impl ProposedChangesEditorToolbar {
|
||||
|
@ -323,7 +337,7 @@ impl Render for ProposedChangesEditorToolbar {
|
|||
if let Some(editor) = &editor {
|
||||
editor.update(cx, |editor, cx| {
|
||||
editor.editor.update(cx, |editor, cx| {
|
||||
editor.apply_all_changes(cx);
|
||||
editor.apply_all_diff_hunks(cx);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue