Create blocks with anchors to allow a bias to be specified

This allows us to respect the bias on anchors we use to create excerpt headers so that they always remain above any content inserted at the start of an excerpt.
This commit is contained in:
Nathan Sobo 2021-12-30 01:03:19 -08:00
parent 984378e12c
commit 6d6a82655a
3 changed files with 23 additions and 29 deletions

View file

@ -123,14 +123,11 @@ impl DisplayMap {
self.block_map.read(snapshot, edits);
}
pub fn insert_blocks<P>(
pub fn insert_blocks(
&mut self,
blocks: impl IntoIterator<Item = BlockProperties<P>>,
blocks: impl IntoIterator<Item = BlockProperties<Anchor>>,
cx: &mut ModelContext<Self>,
) -> Vec<BlockId>
where
P: ToOffset + Clone,
{
) -> Vec<BlockId> {
let snapshot = self.buffer.read(cx).snapshot(cx);
let edits = self.buffer_subscription.consume().into_inner();
let (snapshot, edits) = self.fold_map.read(snapshot, edits);