From 672f2e1d1fbfdb5125415471f3c5f6aa409ef5e2 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Thu, 29 Aug 2024 21:27:14 +0200 Subject: [PATCH] lib: Fix table scroll in imUI --- src/ui/im.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ui/im.rs b/src/ui/im.rs index 81cf4864..ca4a0b6c 100644 --- a/src/ui/im.rs +++ b/src/ui/im.rs @@ -868,14 +868,10 @@ pub mod widget { Style::default().dim() }); - // In order to make the scrollbar work correctly towards the end of the list, - // we need to add a few percent of the total length. - let virtual_length = - self.items.len() * ((self.items.len() as f64).log2() as usize) / 100; - let content_length = area.height as usize + virtual_length; + let content_length = self.items.len(); let mut scroller_state = ScrollbarState::default() - .content_length(self.items.len().saturating_sub(content_length)) + .content_length(content_length) .viewport_content_length(1) .position(state.internal.offset());