diff --git a/crates/gpui/src/elements/uniform_list.rs b/crates/gpui/src/elements/uniform_list.rs index 889494c1bbc5111dd16214bd79798fa412709d77..945340e4c0539bddb4e8a47b2cf9b072b008677b 100644 --- a/crates/gpui/src/elements/uniform_list.rs +++ b/crates/gpui/src/elements/uniform_list.rs @@ -14,6 +14,7 @@ use std::{cmp, ops::Range, sync::Arc}; #[derive(Clone, Default)] pub struct UniformListState(Arc>); +#[derive(Debug)] pub enum ScrollTarget { Show(usize), Center(usize), @@ -98,10 +99,6 @@ where fn autoscroll(&mut self, scroll_max: f32, list_height: f32, item_height: f32) { let mut state = self.state.0.lock(); - if state.scroll_top > scroll_max { - state.scroll_top = scroll_max; - } - if let Some(scroll_to) = state.scroll_to.take() { let item_ix; let center; @@ -130,6 +127,10 @@ where } } } + + if state.scroll_top > scroll_max { + state.scroll_top = scroll_max; + } } fn scroll_top(&self) -> f32 {