From 492b849ea1cec2285ac466f31dde26084021b3f6 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:09:33 +0200 Subject: [PATCH] Do not render multiple hunks for the same line --- crates/editor/src/element.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 0a462b1e5d39489b6abf10d4cca380fc966d7d35..2f69781aa140a48a14befe86b89c70cc460ebce8 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1057,6 +1057,7 @@ impl EditorElement { if layout.is_singleton && scrollbar_settings.selections { let start_anchor = Anchor::min(); let end_anchor = Anchor::max(); + let mut last_rendered_row_range = (-1., -1.); for (row, _) in &editor.background_highlights_in_range( start_anchor..end_anchor, &layout.position_map.snapshot, @@ -1069,6 +1070,11 @@ impl EditorElement { if end_y - start_y < 1. { end_y = start_y + 1.; } + if (start_y, end_y) == last_rendered_row_range { + skipped += 1; + continue; + } + last_rendered_row_range = (start_y, end_y); let bounds = RectF::from_points(vec2f(left, start_y), vec2f(right, end_y)); let color = scrollbar_theme.selections;