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.
This commit is contained in:
Finn Evers
2025-11-26 13:11:47 +00:00
committed by GitHub
parent 1e6a05d0d8
commit 7c724c0f10
+2 -2
View File
@@ -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)