Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Do not render multiple hunks for the same line

Piotr Osiewicz492b849ea1ce
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 0a462b1e5d3..2f69781aa14 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;