diff --git a/src/ui/radarr_ui/mod.rs b/src/ui/radarr_ui/mod.rs index ddbb1a5..36d6337 100644 --- a/src/ui/radarr_ui/mod.rs +++ b/src/ui/radarr_ui/mod.rs @@ -178,8 +178,8 @@ fn draw_downloads_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) { if !downloads_vec.is_empty() { f.render_widget(block, area); - let max_items = (((area.height as f64 / 2.0).floor() * 2.0) as usize) / 2; - let items = cmp::min(downloads_vec.len(), max_items - 1); + let max_items = ((((area.height as f32 / 2.0).floor() * 2.0) as i32) / 2) - 1; + let items = cmp::min(downloads_vec.len(), max_items.unsigned_abs() as usize); let download_item_areas = Layout::vertical( iter::repeat(Constraint::Length(2)) .take(items) diff --git a/src/ui/sonarr_ui/mod.rs b/src/ui/sonarr_ui/mod.rs index dbe45f5..fe95448 100644 --- a/src/ui/sonarr_ui/mod.rs +++ b/src/ui/sonarr_ui/mod.rs @@ -2,7 +2,6 @@ use std::{cmp, iter}; use chrono::{Duration, Utc}; use library::LibraryUi; -use log::debug; use ratatui::{ layout::{Constraint, Layout, Rect}, style::Stylize, @@ -168,10 +167,9 @@ fn draw_downloads_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) { if !downloads_vec.is_empty() { f.render_widget(block, area); - let max_items = (((area.height as f64 / 2.0).floor() * 2.0) as usize) / 2; - let items = cmp::min(downloads_vec.len(), max_items - 1); - debug!("Items: {items}"); + let max_items = ((((area.height as f64 / 2.0).floor() * 2.0) as i64) / 2) - 1; + let items = cmp::min(downloads_vec.len(), max_items.abs() as usize); let download_item_areas = Layout::vertical( iter::repeat(Constraint::Length(2)) .take(items)