We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 064f057 + d87a3b6 commit 415bf69Copy full SHA for 415bf69
src/term.rs
@@ -216,7 +216,9 @@ pub fn progress_bar<'a>(
216
stdout.write_all(PREFIX)?;
217
218
let width = term_width - WRAPPER_WIDTH;
219
- let filled = (width * progress) / total;
+ // Use u32 to prevent the intermediate multiplication from overflowing u16
220
+ let filled = (width as u32 * progress as u32) / total as u32;
221
+ let filled = filled as u16;
222
223
stdout.queue(SetForegroundColor(Color::Green))?;
224
for _ in 0..filled {
0 commit comments