Skip to content

Commit 1a81194

Browse files
committed
fix: use floor() instead of round() for progress bar blocks to show only 10% increments
1 parent a9d2725 commit 1a81194

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,8 @@ fn render_system_info(app: &App, frame: &mut Frame, area: Rect, is_selected: boo
612612
let uptime_hours = uptime / 3600;
613613
let uptime_mins = (uptime % 3600) / 60;
614614

615-
let cpu_blocks = ((cpu_usage / 10.0).round() as usize).min(10).max(0);
616-
let mem_blocks = ((memory_percent as f64 / 10.0).round() as usize).min(10).max(0);
615+
let cpu_blocks = ((cpu_usage / 10.0).floor() as usize).min(10).max(0);
616+
let mem_blocks = ((memory_percent as f64 / 10.0).floor() as usize).min(10).max(0);
617617
let cpu_bar = "█".repeat(cpu_blocks) + &" ".repeat(10 - cpu_blocks);
618618
let mem_bar = "█".repeat(mem_blocks) + &" ".repeat(10 - mem_blocks);
619619

0 commit comments

Comments
 (0)