editor: Shrink DisplayMapSnapshot from 824 to 256 bytes (#39568)

We have unnecessary clones for the fields here as most of the snapshots
contain the others hierarchically.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-10-06 08:08:49 +00:00
committed by GitHub
parent 9c7369f54d
commit 2bfcd60b88
48 changed files with 594 additions and 543 deletions
+2 -2
View File
@@ -33,8 +33,8 @@ const BULLETS: &[u8; u128::BITS as usize] = &[b'*'; _];
///
/// See the [`display_map` module documentation](crate::display_map) for more information.
pub struct BlockMap {
pub(super) wrap_snapshot: RefCell<WrapSnapshot>,
next_block_id: AtomicUsize,
wrap_snapshot: RefCell<WrapSnapshot>,
custom_blocks: Vec<Arc<CustomBlock>>,
custom_blocks_by_id: TreeMap<CustomBlockId, Arc<CustomBlock>>,
transforms: RefCell<SumTree<Transform>>,
@@ -53,7 +53,7 @@ pub struct BlockMapWriter<'a>(&'a mut BlockMap);
#[derive(Clone)]
pub struct BlockSnapshot {
wrap_snapshot: WrapSnapshot,
pub(super) wrap_snapshot: WrapSnapshot,
transforms: SumTree<Transform>,
custom_blocks_by_id: TreeMap<CustomBlockId, Arc<CustomBlock>>,
pub(super) buffer_header_height: u32,
+1 -1
View File
@@ -624,10 +624,10 @@ impl FoldMap {
#[derive(Clone)]
pub struct FoldSnapshot {
pub inlay_snapshot: InlaySnapshot,
transforms: SumTree<Transform>,
folds: SumTree<Fold>,
fold_metadata_by_id: TreeMap<FoldId, FoldMetadata>,
pub inlay_snapshot: InlaySnapshot,
pub version: usize,
}
+1 -1
View File
@@ -30,7 +30,7 @@ pub struct WrapMap {
#[derive(Clone)]
pub struct WrapSnapshot {
tab_snapshot: TabSnapshot,
pub(super) tab_snapshot: TabSnapshot,
transforms: SumTree<Transform>,
interpolated: bool,
}