Add editor::RevertSelectedHunks
to revert git diff hunks in the editor (#9068)
https://github.com/zed-industries/zed/assets/2690773/653b5658-e3f3-4aee-9a9d-0f2153b4141b Release Notes: - Added `editor::RevertSelectedHunks` (`cmd-alt-z` by default) for reverting git hunks from the editor
This commit is contained in:
parent
6a7a3b257a
commit
347178039c
13 changed files with 1003 additions and 72 deletions
|
@ -930,8 +930,17 @@ impl Buffer {
|
|||
/// against the buffer text.
|
||||
pub fn set_diff_base(&mut self, diff_base: Option<String>, cx: &mut ModelContext<Self>) {
|
||||
self.diff_base = diff_base;
|
||||
self.git_diff_recalc(cx);
|
||||
cx.emit(Event::DiffBaseChanged);
|
||||
if let Some(recalc_task) = self.git_diff_recalc(cx) {
|
||||
cx.spawn(|buffer, mut cx| async move {
|
||||
recalc_task.await;
|
||||
buffer
|
||||
.update(&mut cx, |_, cx| {
|
||||
cx.emit(Event::DiffBaseChanged);
|
||||
})
|
||||
.ok();
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
}
|
||||
|
||||
/// Recomputes the Git diff status.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue