project search: Reduce hangs on main thread (#39857)

This takes the idea that @RemcoSmitsDev started on in
https://github.com/zed-industries/zed/pull/39354. We did away with
grabbing a snapshot of the display map when buffer coordinates were
sufficient.
Closes #37267

Release Notes:

- Reduced micro-stutters in project search with large multi-buffer
contents.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
This commit is contained in:
Piotr Osiewicz
2025-10-09 13:11:11 +02:00
committed by GitHub
co-authored by Smit Barmase
parent 37d676e2c6
commit ba2337ffb9
5 changed files with 84 additions and 41 deletions
+11
View File
@@ -6385,6 +6385,17 @@ impl MultiBufferSnapshot {
debug_ranges.insert(key, text_ranges, format!("{value:?}").into())
});
}
// used by line_mode selections and tries to match vim behavior
pub fn expand_to_line(&self, range: Range<Point>) -> Range<Point> {
let new_start = MultiBufferPoint::new(range.start.row, 0);
let new_end = if range.end.column > 0 {
MultiBufferPoint::new(range.end.row, self.line_len(MultiBufferRow(range.end.row)))
} else {
range.end
};
new_start..new_end
}
}
#[cfg(any(test, feature = "test-support"))]