From 14bc2c685736bb75267337e75cf703208fc589c4 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 28 Sep 2021 12:26:15 -0600 Subject: [PATCH] Fix scrolling of project panel Co-Authored-By: Max Brunsfeld --- gpui/src/elements/uniform_list.rs | 2 +- zed/src/project_panel.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gpui/src/elements/uniform_list.rs b/gpui/src/elements/uniform_list.rs index 298f87d3bb095d060dde66033bc575d056b9d26e..aefe30e67b20220d96b7924ac96d91939a910852 100644 --- a/gpui/src/elements/uniform_list.rs +++ b/gpui/src/elements/uniform_list.rs @@ -137,7 +137,7 @@ where size.set_y(size.y().min(scroll_height).max(constraint.min.y())); } - scroll_max = item_height * self.item_count as f32 - size.y(); + scroll_max = (item_height * self.item_count as f32 - size.y()).max(0.); self.autoscroll(scroll_max, size.y(), item_height); items.clear(); diff --git a/zed/src/project_panel.rs b/zed/src/project_panel.rs index 500ac03fd09e8eae3476189983f1a77466727b47..5866569a4555ad1418b7413db8021d89e2f12206 100644 --- a/zed/src/project_panel.rs +++ b/zed/src/project_panel.rs @@ -193,7 +193,10 @@ impl View for ProjectPanel { let handle = self.handle.clone(); UniformList::new( self.list.clone(), - self.visible_entries.len(), + self.visible_entries + .iter() + .map(|worktree_entries| worktree_entries.len()) + .sum(), move |range, items, cx| { let theme = &settings.borrow().theme.project_panel; let this = handle.upgrade(cx).unwrap();