wip
This commit is contained in:
parent
ae3bdd755e
commit
54421b11f3
2 changed files with 57 additions and 1 deletions
|
@ -682,6 +682,20 @@ impl Buffer {
|
|||
self.git_diff_status.diff.needs_update(self)
|
||||
}
|
||||
|
||||
fn git_diff_recalc_2(&mut self, cx: &mut ModelContext<Self>) -> Option<Task<()>> {
|
||||
let diff_base = &self.diff_base?;
|
||||
let snapshot = self.snapshot();
|
||||
let handle = cx.weak_handle();
|
||||
|
||||
let mut diff = self.git_diff_status.diff.clone();
|
||||
Some(cx.background().spawn(async move {
|
||||
diff.update(&diff_base, &snapshot).await;
|
||||
if let Some(this) = handle.upgrade(cx) {
|
||||
// this.update(cx)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn git_diff_recalc(&mut self, cx: &mut ModelContext<Self>) {
|
||||
if self.git_diff_status.update_in_progress {
|
||||
self.git_diff_status.update_requested = true;
|
||||
|
@ -689,6 +703,7 @@ impl Buffer {
|
|||
}
|
||||
|
||||
if let Some(diff_base) = &self.diff_base {
|
||||
self.git_diff_status.update_in_progress = true;
|
||||
let snapshot = self.snapshot();
|
||||
let diff_base = diff_base.clone();
|
||||
|
||||
|
@ -706,9 +721,10 @@ impl Buffer {
|
|||
this.git_diff_update_count += 1;
|
||||
cx.notify();
|
||||
|
||||
this.git_diff_status.update_in_progress = false;
|
||||
if this.git_diff_status.update_requested {
|
||||
this.git_diff_recalc(cx);
|
||||
} else {
|
||||
this.git_diff_status.update_in_progress = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue