Return a Fold
struct when querying the FoldMap
This contains a new `id` field that lets us distinguish among folds. Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
851a60a68e
commit
3ff8c78b58
6 changed files with 87 additions and 48 deletions
|
@ -31,7 +31,7 @@ pub use block_map::{
|
|||
BlockDisposition, BlockId, BlockProperties, BlockStyle, RenderBlock, TransformBlock,
|
||||
};
|
||||
|
||||
pub use self::fold_map::FoldPoint;
|
||||
pub use self::fold_map::{Fold, FoldPoint};
|
||||
pub use self::inlay_map::{Inlay, InlayOffset, InlayPoint};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
|
@ -124,7 +124,7 @@ impl DisplayMap {
|
|||
self.fold(
|
||||
other
|
||||
.folds_in_range(0..other.buffer_snapshot.len())
|
||||
.map(|fold| fold.to_offset(&other.buffer_snapshot)),
|
||||
.map(|fold| fold.range.to_offset(&other.buffer_snapshot)),
|
||||
cx,
|
||||
);
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ impl DisplaySnapshot {
|
|||
DisplayPoint(point)
|
||||
}
|
||||
|
||||
pub fn folds_in_range<T>(&self, range: Range<T>) -> impl Iterator<Item = &Range<Anchor>>
|
||||
pub fn folds_in_range<T>(&self, range: Range<T>) -> impl Iterator<Item = &Fold>
|
||||
where
|
||||
T: ToOffset,
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue