Project level git diff recalc handling

This avoids an issue where in a many-buffer multi-buffer, each modified
buffer could complete its recalc independently, causing a cascade of
repeated notifies

Now all recalcs started at the same time must complete before
 A: Starting another recalc pass
 B: The master notify occurring

Each buffer can still show its new diff if something else triggers it
to notify earlier, this is desirable and does not have the same negative
effects as the notify cascade as those re-layouts would need to happen
anyway

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Julia 2023-05-18 18:25:58 -04:00
parent 54421b11f3
commit cede296b04
4 changed files with 64 additions and 37 deletions

View file

@ -343,15 +343,15 @@ impl MultiBuffer {
self.read(cx).symbols_containing(offset, theme)
}
pub fn git_diff_recalc(&mut self, cx: &mut ModelContext<Self>) {
let buffers = self.buffers.borrow();
for buffer_state in buffers.values() {
if buffer_state.buffer.read(cx).needs_git_diff_recalc() {
buffer_state
.buffer
.update(cx, |buffer, cx| buffer.git_diff_recalc(cx))
}
}
pub fn git_diff_recalc(&mut self, _: &mut ModelContext<Self>) {
// let buffers = self.buffers.borrow();
// for buffer_state in buffers.values() {
// if buffer_state.buffer.read(cx).needs_git_diff_recalc() {
// buffer_state
// .buffer
// .update(cx, |buffer, cx| buffer.git_diff_recalc(cx))
// }
// }
}
pub fn edit<I, S, T>(