From dc09e4e28d893f1f80801ebd9f673caed3244a7b Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Tue, 2 Dec 2025 11:52:42 -0500 Subject: [PATCH] wip Co-authored-by: Anthony Eid Co-authored-by: cameron --- crates/editor/src/display_map/block_map.rs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index 084322d5b9..4a3ab6de97 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -748,6 +748,13 @@ impl BlockMap { }, )); + blocks_in_edit.extend(self.spacer_blocks( + buffer, + wrap_snapshot, + companion_wrap_snapshot, + (start_bound, end_bound), + )); + BlockMap::sort_blocks(&mut blocks_in_edit); // For each of these blocks, insert a new isomorphic transform preceding the block, @@ -970,6 +977,26 @@ impl BlockMap { _ => false, }); } + + fn spacer_blocks<'a>( + &'a self, + buffer: &MultiBufferSnapshot, + wrap_snapshot: &WrapSnapshot, + companion_wrap_snapshot: Option<&WrapSnapshot>, + bounds: (Bound, Bound), + ) -> impl Iterator, Block)> + 'a { + // 0. find the matching positions for the start of the edit in the two wrap snapshots + // 1. loop: + // if (at_end_of_edit) + // done + // else if (in_hunk) + // advance to end of hunk on both sides + // spacer_size = sizes based on the hunk (in wraprows) + // else + // advance to next buffer line on both sides + // spacer_size = size of buffer_line in companion (in wraprows) + // yield a spacer based on the size + } } fn push_isomorphic(tree: &mut SumTree, rows: RowDelta, wrap_snapshot: &WrapSnapshot) {