Fix stale hunks after commit (#24663)

Fixes a regression introduced in #24475.

Release Notes:

- N/A
This commit is contained in:
Cole Miller authored and GitHub committed 2025-02-11 11:39:57 -05:00
1 parent d25dfbcdc6
commit cd07b98130
2 files changed
+9 -14

No files matched your search

+6 -8
View File
@@ -587,18 +587,16 @@ impl BufferDiff {
range: Range<Anchor>,
buffer: &text::BufferSnapshot,
cx: &App,
) -> Option<Range<Anchor>> {
) -> Range<Anchor> {
let start = self
.hunks_intersecting_range(range.clone(), &buffer, cx)
.next()?
.buffer_range
.start;
.next()
.map_or(Anchor::MIN, |hunk| hunk.buffer_range.start);
let end = self
.hunks_intersecting_range_rev(range.clone(), &buffer)
.next()?
.buffer_range
.end;
Some(start..end)
.next()
.map_or(Anchor::MAX, |hunk| hunk.buffer_range.end);
start..end
}
#[allow(clippy::too_many_arguments)]