History

Touch up stale hunks fix (#24669)

Release Notes: - N/A

Cole Miller committed 1 year ago

Commit 759ea0e1 parent 7c00eec2 files · +19 −13Browse files

Showing the changes to crates/buffer_diff/src/buffer_diff.rs (1 of 2 files). Show all

Unified · Split

crates/buffer_diff/src/buffer_diff.rs+8−6
@@ -587,16 +587,18 @@ impl BufferDiff { · 586 unmodified lines
587587 range: Range<Anchor>,
588588 buffer: &text::BufferSnapshot,
589589 cx: &App,
590− ) -> Range<Anchor> {
590+ ) -> Option<Range<Anchor>> {
591591 let start = self
592592 .hunks_intersecting_range(range.clone(), &buffer, cx)
593− .next()
594− .map_or(Anchor::MIN, |hunk| hunk.buffer_range.start);
593+ .next()?
594+ .buffer_range
595+ .start;
595596 let end = self
596597 .hunks_intersecting_range_rev(range.clone(), &buffer)
597− .next()
598− .map_or(Anchor::MAX, |hunk| hunk.buffer_range.end);
599− start..end
598+ .next()?
599+ .buffer_range
600+ .end;
601+ Some(start..end)
600602 }
601603
602604 #[allow(clippy::too_many_arguments)]

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t