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.

Fix fold indicator offsets

Mikayla Makie729c4ad4f00
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 69e39b65d38..c1a489f48e9 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -576,13 +576,16 @@ impl EditorElement {
for (ix, fold_indicator) in layout.fold_indicators.iter_mut().enumerate() {
if let Some(indicator) = fold_indicator.as_mut() {
- let mut x = bounds.width() - layout.gutter_padding;
- let mut y = ix as f32 * line_height - scroll_top;
-
- x += ((layout.gutter_padding + layout.gutter_margin) - indicator.size().x()) / 2.;
- y += (line_height - indicator.size().y()) / 2.;
+ let position = vec2f(
+ bounds.width() - layout.gutter_padding,
+ ix as f32 * line_height - (scroll_top % line_height),
+ );
+ let centering_offset = vec2f(
+ ((layout.gutter_padding + layout.gutter_margin - indicator.size().x()) / 2.),
+ (line_height - indicator.size().y()) / 2.,
+ );
- let indicator_origin = bounds.origin() + vec2f(x, y);
+ let indicator_origin = bounds.origin() + position + centering_offset;
indicator.paint(indicator_origin, visible_bounds, cx);
}