Fix stale hunks after commit (#24663)

Fixes a regression introduced in #24475.

Release Notes:

- N/A
This commit is contained in:
Cole Miller 2025-02-11 11:39:57 -05:00 committed by GitHub
parent bbea3a2184
commit 6e7416eb00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 14 deletions

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)]