multi_buffer: Remove redundant buffer id field (#43459)

It is easy for us to get the two fields out of sync causing weird
problems, there is no reason to have both here so.

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Co-authored by: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
Lukas Wirth
2025-11-25 17:13:16 +01:00
committed by GitHub
parent ab80ef1845
commit fafe1afa61
39 changed files with 378 additions and 306 deletions
+7 -7
View File
@@ -383,12 +383,8 @@ impl ProjectDiff {
.collect::<Vec<_>>();
if !ranges.iter().any(|range| range.start != range.end) {
selection = false;
if let Some((excerpt_id, buffer, range)) = self.editor.read(cx).active_excerpt(cx) {
ranges = vec![multi_buffer::Anchor::range_in_buffer(
excerpt_id,
buffer.read(cx).remote_id(),
range,
)];
if let Some((excerpt_id, _, range)) = self.editor.read(cx).active_excerpt(cx) {
ranges = vec![multi_buffer::Anchor::range_in_buffer(excerpt_id, range)];
} else {
ranges = Vec::default();
}
@@ -488,7 +484,11 @@ impl ProjectDiff {
let snapshot = buffer.read(cx).snapshot();
let diff_read = diff.read(cx);
let diff_hunk_ranges = diff_read
.hunks_intersecting_range(Anchor::MIN..Anchor::MAX, &snapshot, cx)
.hunks_intersecting_range(
Anchor::min_max_range_for_buffer(diff_read.buffer_id),
&snapshot,
cx,
)
.map(|diff_hunk| diff_hunk.buffer_range);
let conflicts = conflict_addon
.conflict_set(snapshot.remote_id())