Batch anchor resolution, avoid cloning fragment ids when seeking
This commit is contained in:
parent
e9c385e7a6
commit
1ed1ec21dd
3 changed files with 73 additions and 12 deletions
|
@ -125,7 +125,18 @@ impl SelectionSet {
|
|||
where
|
||||
D: 'a + TextDimension<'a>,
|
||||
{
|
||||
self.selections.iter().map(|s| s.resolve(snapshot))
|
||||
let anchors = self
|
||||
.selections
|
||||
.iter()
|
||||
.flat_map(|selection| [&selection.start, &selection.end].into_iter());
|
||||
let mut positions = snapshot.summaries_for_anchors::<D, _>(anchors);
|
||||
self.selections.iter().map(move |selection| Selection {
|
||||
start: positions.next().unwrap(),
|
||||
end: positions.next().unwrap(),
|
||||
goal: selection.goal,
|
||||
reversed: selection.reversed,
|
||||
id: selection.id,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn intersecting_selections<'a, D, I>(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue