mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-10 05:37:29 +03:00
Apply scroll_max after uniform list autoscrolls
This commit is contained in:
parent
dd8e5ee543
commit
f3239fe1d5
@ -14,6 +14,7 @@ use std::{cmp, ops::Range, sync::Arc};
|
||||
#[derive(Clone, Default)]
|
||||
pub struct UniformListState(Arc<Mutex<StateInner>>);
|
||||
|
||||
#[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 {
|
||||
|
Loading…
Reference in New Issue
Block a user