mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-31 10:11:07 +00:00
Fix bug where max_width is not initialized after line break
This commit is contained in:
parent
944866affd
commit
25640a8a81
@ -471,7 +471,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
&mut cursor_total,
|
&mut cursor_total,
|
||||||
);
|
);
|
||||||
|
|
||||||
let max_width = cursor_max - cursor;
|
let mut max_width = cursor_max - cursor;
|
||||||
|
|
||||||
// line buffer (avoid calling write! for every character)
|
// line buffer (avoid calling write! for every character)
|
||||||
let mut line_buf = String::with_capacity(max_width * 4);
|
let mut line_buf = String::with_capacity(max_width * 4);
|
||||||
@ -505,8 +505,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor = 0;
|
|
||||||
|
|
||||||
// It wraps.
|
// It wraps.
|
||||||
write!(
|
write!(
|
||||||
handle,
|
handle,
|
||||||
@ -525,6 +523,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
panel_wrap.clone().unwrap()
|
panel_wrap.clone().unwrap()
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
cursor = 0;
|
||||||
|
max_width = cursor_max;
|
||||||
|
|
||||||
line_buf.clear();
|
line_buf.clear();
|
||||||
current_width = cw;
|
current_width = cw;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user