mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-30 22:34:41 +03:00
Optimize summaries_for_anchors
when MultiBuffer
is a singleton
This commit is contained in:
parent
ab26a175a4
commit
7865c32727
@ -1543,6 +1543,13 @@ impl MultiBufferSnapshot {
|
||||
D: TextDimension + Ord + Sub<D, Output = D>,
|
||||
I: 'a + IntoIterator<Item = &'a Anchor>,
|
||||
{
|
||||
if let Some(excerpt) = self.as_singleton() {
|
||||
return excerpt
|
||||
.buffer
|
||||
.summaries_for_anchors(anchors.into_iter().map(|a| &a.text_anchor))
|
||||
.collect();
|
||||
}
|
||||
|
||||
let mut anchors = anchors.into_iter().peekable();
|
||||
let mut cursor = self.excerpts.cursor::<ExcerptSummary>();
|
||||
let mut summaries = Vec::new();
|
||||
|
Loading…
Reference in New Issue
Block a user