Fixing scrollbar view content

This commit is contained in:
Marco De Araujo 2026-01-11 14:06:12 -04:00
parent 000e31a14f
commit 60e4fa3b9d
2 changed files with 14 additions and 10 deletions

View file

@ -18,10 +18,10 @@ const MAX_NAME_LENGTH: usize = 30;
pub fn render_monitor_list(main_frame: &mut Frame, area: Rect, state: &mut DashboardViewState) {
let available_height = area.height as usize;
let total_lenght = state.get_total_lenght();
let max_scroll = state.get_total_lenght().saturating_sub(available_height);
if (state.scroll_state.get_position() + available_height) > total_lenght {
state.scroll_state = state.scroll_state.position(total_lenght - available_height);
if state.scroll_state.get_position() > max_scroll {
state.scroll_state = state.scroll_state.position(max_scroll);
}
let scroll_pos = state.scroll_state.get_position();