From 0798c642d44a44f9c919b363fe6b03e9f6b03863 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 26 Oct 2024 21:57:22 +0300 Subject: [PATCH] Restore horizontal scrollbar checks (#19767) Closes https://github.com/zed-industries/zed/issues/19637 Follow-up of https://github.com/zed-industries/zed/pull/18927 , restores the condition that removed the horizontal scrollbar when panel's items are not long enough. Release Notes: - Fixed horizontal scrollbar not being hidden ([#19637](https://github.com/zed-industries/zed/issues/19637)) --- crates/project_panel/src/project_panel.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 491480936976e69910143a6528d8b5f8b161e0ed..0de1c5824e67d847359de19d2e8cd17ea478aa7d 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -2659,6 +2659,17 @@ impl ProjectPanel { return None; } + let scroll_handle = self.scroll_handle.0.borrow(); + let longest_item_width = scroll_handle + .last_item_size + .filter(|size| size.contents.width > size.item.width)? + .contents + .width + .0 as f64; + if longest_item_width < scroll_handle.base_handle.bounds().size.width.0 as f64 { + return None; + } + Some( div() .occlude()