diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index 210daccac26b54e057947457b52c4c749e2adb61..c60610997fb088320aec6908a3c24022a0d83d6b 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 c17cfa39f2a7292198a1c953339e315824fe73b8..756fb35950384f9f61c39db38456475557b4b85d 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 ee6ce2860ded8f830481258e5a8e4c59d7bbeba9..52f26ef2589c043877a56360934d072c14d15944 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 17dfabe57601c4e71591ad7857df3f6add628025..5b752e05447b1d0ccba5209745bcd0e683371d24 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 a0eedb850c03b04ed9ccf879484f96553d13ac90..b2635712d96981653dfd49d6eb87f1cfc6fcce1d 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>,