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.

markdown: Fix code block scrollbars flashing on vertical scroll (#50817)

Xiaobo Liu7a4aaff8ea33
diff --git a/crates/ui/src/components/scrollbar.rs b/crates/ui/src/components/scrollbar.rs
index 21d6aa46d0f..d0c720d5081 100644
--- a/crates/ui/src/components/scrollbar.rs
+++ b/crates/ui/src/components/scrollbar.rs
@@ -1041,7 +1041,18 @@ impl ScrollbarLayout {
impl PartialEq for ScrollbarLayout {
fn eq(&self, other: &Self) -> bool {
- self.axis == other.axis && self.thumb_bounds == other.thumb_bounds
+ if self.axis != other.axis {
+ return false;
+ }
+
+ let axis = self.axis;
+ let thumb_offset =
+ self.thumb_bounds.origin.along(axis) - self.track_bounds.origin.along(axis);
+ let other_thumb_offset =
+ other.thumb_bounds.origin.along(axis) - other.track_bounds.origin.along(axis);
+
+ thumb_offset == other_thumb_offset
+ && self.thumb_bounds.size.along(axis) == other.thumb_bounds.size.along(axis)
}
}