2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-16 21:25:56 +00:00

Fix bug where max_width is not initialized after line break

This commit is contained in:
Kogia-sima 2020-02-01 20:25:07 +09:00 committed by David Peter
parent 944866affd
commit 25640a8a81

View File

@ -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;
}