Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ pub fn progress_bar<'a>(
stdout.write_all(PREFIX)?;

let width = term_width - WRAPPER_WIDTH;
let filled = (width * progress) / total;
// Use u32 to prevent the intermediate multiplication from overflowing u16
let filled = (width as u32 * progress as u32) / total as u32;
let filled = filled as u16;

stdout.queue(SetForegroundColor(Color::Green))?;
for _ in 0..filled {
Expand Down