text: Actually short circuit anchored_edits_since_in_range (#48486)

When the version is the same we used to still seek through the
underlying fragment sumtree despite having nothing to return. This has a
lot of unnecessary overhead.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth authored and GitHub committed 2026-02-05 15:57:11 +00:00
1 parent 4389ebb6f4
commit 723f683dda
4 files changed
+29 -16

No files matched your search

+11 -5
View File
@@ -3052,11 +3052,17 @@ impl MultiBuffer {
*non_text_state_update_count += 1;
}
for (id, diff) in diffs.iter() {
if buffer_diff.get(id).is_none() || diff.is_inverted {
buffer_diff.insert(*id, diff.snapshot(cx));
}
}
let diffs_to_add = diffs
.iter()
.filter_map(|(id, diff)| {
if diff.is_inverted || buffer_diff.get(id).is_none() {
Some((*id, diff.snapshot(cx)))
} else {
None
}
})
.collect::<Vec<_>>();
buffer_diff.extend(diffs_to_add);
excerpts_to_edit.sort_unstable_by_key(|(locator, _, _)| *locator);