From 7c724c0f1049e610c541c2f4f6a8739f91865e02 Mon Sep 17 00:00:00 2001 From: Finn Evers Date: Wed, 26 Nov 2025 14:11:47 +0100 Subject: [PATCH] editor: Do not show scroll thumb if page fits (#43548) Follow-up to https://github.com/zed-industries/zed/pull/39367 Release Notes: - Fixed a small issue where a scrollbar would sometimes show in the editor although the content fix exactly on screen. --- crates/editor/src/element.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 4ea12f0a21295d97cdcff565c484750e14334223..c85528353fc23ac2da4cca3682e28a30cda37f9c 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -10712,9 +10712,9 @@ impl ScrollbarLayout { show_thumb: bool, axis: ScrollbarAxis, ) -> Self { - let text_units_per_page = f64::from(viewport_size / glyph_space); + let text_units_per_page = viewport_size.to_f64() / glyph_space.to_f64(); let visible_range = scroll_position..scroll_position + text_units_per_page; - let total_text_units = scroll_range / f64::from(glyph_space); + let total_text_units = scroll_range / glyph_space.to_f64(); let thumb_percentage = text_units_per_page / total_text_units; let thumb_size = Pixels::from(ScrollOffset::from(track_length) * thumb_percentage)