Fix bug where max_width is not initialized after line break
@@ -471,7 +471,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
&mut cursor_total,
);
- let max_width = cursor_max - cursor;
+ let mut max_width = cursor_max - cursor;
// line buffer (avoid calling write! for every character)
let mut line_buf = String::with_capacity(max_width * 4);
@@ -505,8 +505,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
}
}
- cursor = 0;
-
// It wraps.
write!(
handle,
@@ -525,6 +523,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
panel_wrap.clone().unwrap()
)?;
+ cursor = 0;
+ max_width = cursor_max;
+
line_buf.clear();
current_width = cw;
}
