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 `vertical_scroll_margin` not being capped for large `vertical_scroll_margin` values (#15473)

Massimo Munde783142528ca
diff --git a/crates/editor/src/scroll/autoscroll.rs b/crates/editor/src/scroll/autoscroll.rs
index b5e220bc74e..a69b4a11b74 100644
--- a/crates/editor/src/scroll/autoscroll.rs
+++ b/crates/editor/src/scroll/autoscroll.rs
@@ -189,8 +189,8 @@ impl Editor {
self.set_scroll_position_internal(scroll_position, local, true, cx);
}
AutoscrollStrategy::Focused => {
- scroll_position.y =
- (target_top - self.scroll_manager.vertical_scroll_margin).max(0.0);
+ let margin = margin.min(self.scroll_manager.vertical_scroll_margin);
+ scroll_position.y = (target_top - margin).max(0.0);
self.set_scroll_position_internal(scroll_position, local, true, cx);
}
AutoscrollStrategy::Top => {