Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: Ensure topmost buffer header can be properly folded (#34721)
Finn Evers5b18ce79abb0
diff --git a/crates/editor/src/scroll.rs b/crates/editor/src/scroll.rsindex 7310d6d3c05..ecaf7c11e41 100644--- a/crates/editor/src/scroll.rs+++ b/crates/editor/src/scroll.rs@@ -12,7 +12,7 @@ use crate::{};pub use autoscroll::{Autoscroll, AutoscrollStrategy};use core::fmt::Debug;-use gpui::{App, Axis, Context, Global, Pixels, Task, Window, point, px};+use gpui::{Along, App, Axis, Context, Global, Pixels, Task, Window, point, px};use language::language_settings::{AllLanguageSettings, SoftWrap};use language::{Bias, Point};pub use scroll_amount::ScrollAmount;@@ -49,14 +49,14 @@ impl ScrollAnchor {}pub fn scroll_position(&self, snapshot: &DisplaySnapshot) -> gpui::Point<f32> {- let mut scroll_position = self.offset;- if self.anchor == Anchor::min() {- scroll_position.y = 0.;- } else {- let scroll_top = self.anchor.to_display_point(snapshot).row().as_f32();- scroll_position.y += scroll_top;- }- scroll_position+ self.offset.apply_along(Axis::Vertical, |offset| {+ if self.anchor == Anchor::min() {+ 0.+ } else {+ let scroll_top = self.anchor.to_display_point(snapshot).row().as_f32();+ (offset + scroll_top).max(0.)+ }+ })}pub fn top_row(&self, buffer: &MultiBufferSnapshot) -> u32 {