From 3ac489a8b6722eb488675b758a3ee4ac0cd03466 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 24 Aug 2021 17:51:37 -0600 Subject: [PATCH] Fix panic when scrolling non-overflowing lists Co-Authored-By: Max Brunsfeld --- gpui/src/elements/list.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gpui/src/elements/list.rs b/gpui/src/elements/list.rs index 2e692f4a9914a31284d3fdbb850c798995ade25c..78f8c2316e32ffc3ab4679d1461ae78f7967f1c6 100644 --- a/gpui/src/elements/list.rs +++ b/gpui/src/elements/list.rs @@ -234,8 +234,9 @@ impl StateInner { todo!("still need to handle non-precise scroll events from a mouse wheel"); } - let scroll_max = self.heights.summary().height - height; - self.scroll_top = (self.scroll_top - delta.y()).max(0.0).min(scroll_max); + let scroll_max = (self.heights.summary().height - height).max(0.); + self.scroll_top = (self.scroll_top - delta.y()).max(0.).min(scroll_max); + cx.notify(); true