Rewrite multi-buffer aware git hunks in range to be more correct

Less ad-hoc state tracking, rely more on values provided by the
underlying data

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Julia 2022-12-15 17:09:09 -05:00
parent 0dedc1f3a4
commit f88b413f6a
3 changed files with 211 additions and 32 deletions

View file

@ -2318,12 +2318,13 @@ impl BufferSnapshot {
self.git_diff.hunks_in_row_range(range, self, reversed)
}
pub fn git_diff_hunks_in_range<'a>(
pub fn git_diff_hunks_intersecting_range<'a>(
&'a self,
range: Range<Anchor>,
reversed: bool,
) -> impl 'a + Iterator<Item = git::diff::DiffHunk<u32>> {
self.git_diff.hunks_in_range(range, self, reversed)
self.git_diff
.hunks_intersecting_range(range, self, reversed)
}
pub fn diagnostics_in_range<'a, T, O>(