diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index 210daccac2..c60610997f 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -157,6 +157,7 @@ pub struct BlockChunks<'a> { max_output_row: u32, } +#[derive(Clone)] pub struct BlockBufferRows<'a> { transforms: sum_tree::Cursor<'a, Transform, (BlockRow, WrapRow)>, input_buffer_rows: wrap_map::WrapBufferRows<'a>, diff --git a/crates/editor/src/display_map/fold_map.rs b/crates/editor/src/display_map/fold_map.rs index c17cfa39f2..756fb35950 100644 --- a/crates/editor/src/display_map/fold_map.rs +++ b/crates/editor/src/display_map/fold_map.rs @@ -987,6 +987,7 @@ impl<'a> sum_tree::Dimension<'a, FoldSummary> for usize { } } +#[derive(Clone)] pub struct FoldBufferRows<'a> { cursor: Cursor<'a, Transform, (FoldPoint, Point)>, input_buffer_rows: MultiBufferRows<'a>, diff --git a/crates/editor/src/display_map/wrap_map.rs b/crates/editor/src/display_map/wrap_map.rs index ee6ce2860d..52f26ef258 100644 --- a/crates/editor/src/display_map/wrap_map.rs +++ b/crates/editor/src/display_map/wrap_map.rs @@ -62,6 +62,7 @@ pub struct WrapChunks<'a> { transforms: Cursor<'a, Transform, (WrapPoint, TabPoint)>, } +#[derive(Clone)] pub struct WrapBufferRows<'a> { input_buffer_rows: fold_map::FoldBufferRows<'a>, input_buffer_row: Option, diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 17dfabe576..5b752e0544 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1042,15 +1042,27 @@ impl EditorElement { rows: Range, snapshot: &EditorSnapshot, ) -> Vec { + let buffer_rows = snapshot.buffer_rows(rows.start); + let start_actual_row = match buffer_rows + .clone() + .take((rows.end - rows.start) as usize) + .find_map(|b| b) + { + Some(start_actual_row) => start_actual_row, + None => return Vec::new(), + }; + + //Get all hunks after our starting actual buffer row + //The loop is in terms of visual buffer rows so we simply + //return before touching any hunks past the end of the view let mut diff_hunks = snapshot .buffer_snapshot - .git_diff_hunks_in_range(rows.clone()) + .git_diff_hunks_in_range(start_actual_row..u32::MAX) .peekable(); //Some number followed by Nones for wrapped lines //Jump in number for folded lines - let mut buffer_rows = snapshot - .buffer_rows(rows.start) + let mut buffer_rows = buffer_rows .take((rows.end - rows.start) as usize) .enumerate() .peekable(); diff --git a/crates/editor/src/multi_buffer.rs b/crates/editor/src/multi_buffer.rs index a0eedb850c..b2635712d9 100644 --- a/crates/editor/src/multi_buffer.rs +++ b/crates/editor/src/multi_buffer.rs @@ -143,6 +143,7 @@ struct ExcerptSummary { text: TextSummary, } +#[derive(Clone)] pub struct MultiBufferRows<'a> { buffer_row_range: Range, excerpts: Cursor<'a, Excerpt, Point>,