From cbe27997bdecb7b8ef48a70a26e02af40f382c86 Mon Sep 17 00:00:00 2001 From: Zeb Piasecki Date: Mon, 19 Aug 2024 10:51:03 -0400 Subject: [PATCH] fix: add extra row for basic cpu widget if using avg row on cores % 4 != 0 (#1565) --- src/canvas.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/canvas.rs b/src/canvas.rs index 3ecc446f1..c789b5f16 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -356,8 +356,12 @@ impl Painter { // This fixes #397, apparently if the height is 1, it can't render the CPU // bars... let cpu_height = { - let c = - (actual_cpu_data_len / 4) as u16 + u16::from(actual_cpu_data_len % 4 != 0); + let c = (actual_cpu_data_len / 4) as u16 + + u16::from(actual_cpu_data_len % 4 != 0) + + u16::from( + app_state.app_config_fields.dedicated_average_row + && actual_cpu_data_len.saturating_sub(1) % 4 != 0, + ); if c <= 1 { 1