From 81582cd7f38fae97d906ac131d28a9c00c71fc88 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 18 Mar 2025 23:00:41 -0600 Subject: [PATCH] Don't render breakpoint indicators on top of expand arrows (#27048) Closes #ISSUE cc @Anthony-Eid. One thing I noticed while doing this is that we do an invalid cast here from DisplayPoint.row to MultiBufferRow. These are not the same if you have soft-wrap enabled (or anything else in the display map that's not in the editor). Release Notes: - N/A --- crates/editor/src/element.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 06d2204165756412cb3aa5711e65ef964495adee..2b6c61bc7ce55735a1eacd41a3d283c9fe2deffd 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -2048,7 +2048,6 @@ impl EditorElement { (offset_y, length) } - #[allow(clippy::too_many_arguments)] fn layout_breakpoints( &self, line_height: Pixels, @@ -2059,16 +2058,24 @@ impl EditorElement { display_hunks: &[(DisplayDiffHunk, Option)], snapshot: &EditorSnapshot, breakpoints: HashMap, + row_infos: &[RowInfo], window: &mut Window, cx: &mut App, ) -> Vec { self.editor.update(cx, |editor, cx| { breakpoints .into_iter() - .filter_map(|(point, (text_anchor, bp))| { - let row = MultiBufferRow { 0: point.0 }; + .filter_map(|(display_row, (text_anchor, bp))| { + let row = MultiBufferRow { 0: display_row.0 }; + + if row_infos + .get((display_row.0.saturating_sub(range.start.0)) as usize) + .is_some_and(|row_info| row_info.expand_info.is_some()) + { + return None; + } - if range.start > point || range.end < point { + if range.start > display_row || range.end < display_row { return None; } @@ -2076,11 +2083,11 @@ impl EditorElement { return None; } - let button = editor.render_breakpoint(text_anchor, point, &bp.kind, cx); + let button = editor.render_breakpoint(text_anchor, display_row, &bp.kind, cx); let button = prepaint_gutter_button( button, - point, + display_row, line_height, gutter_dimensions, scroll_pixel_position, @@ -7526,6 +7533,7 @@ impl Element for EditorElement { &display_hunks, &snapshot, breakpoint_rows, + &row_infos, window, cx, )