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.

editor: Do not show scroll thumb if page fits (#43548)

Finn Evers7c724c0f1049
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 4ea12f0a212..c85528353fc 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)