Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: extend diff hunk range for custom transform blocks. (#4012)
Piotr Osiewicz0db7559e964a
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rsindex 1791fcc2927..4a648b37709 100644--- a/crates/editor/src/element.rs+++ b/crates/editor/src/element.rs@@ -809,13 +809,18 @@ impl EditorElement {// the hunk might include the rows of that header.// Making the range inclusive doesn't quite cut it, as we rely on the exclusivity for the soft wrap.// Instead, we simply check whether the range we're dealing with includes- // any custom elements and if so, we stop painting the diff hunk on the first row of that custom element.+ // any excerpt headers and if so, we stop painting the diff hunk on the first row of that header.let end_row_in_current_excerpt = layout.position_map.snapshot.blocks_in_range(start_row..end_row)- .next()- .map(|(start_row, _)| start_row)+ .find_map(|(start_row, block)| {+ if matches!(block, TransformBlock::ExcerptHeader { .. }) {+ Some(start_row)+ } else {+ None+ }+ }).unwrap_or(end_row);let start_y = start_row as f32 * line_height - scroll_top;