mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-23 16:23:43 +01:00
parent
5d3205acc0
commit
fee57d71d9
@ -309,11 +309,13 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
|
|
||||||
for &(style, region) in regions.iter() {
|
for &(style, region) in regions.iter() {
|
||||||
let text = &*self.preprocess(region, &mut cursor_total);
|
let text = &*self.preprocess(region, &mut cursor_total);
|
||||||
|
let text_trimmed = text.trim_end_matches(|c| c == '\r' || c == '\n');
|
||||||
write!(
|
write!(
|
||||||
handle,
|
handle,
|
||||||
"{}",
|
"{}",
|
||||||
as_terminal_escaped(style, &*text, true_color, colored_output, italics,)
|
as_terminal_escaped(style, text_trimmed, true_color, colored_output, italics,)
|
||||||
)?;
|
)?;
|
||||||
|
write!(handle, "{}", &text[text_trimmed.len()..])?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if line.bytes().next_back() != Some(b'\n') {
|
if line.bytes().next_back() != Some(b'\n') {
|
||||||
@ -342,7 +344,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
// Regular text.
|
// Regular text.
|
||||||
(text, false) => {
|
(text, false) => {
|
||||||
let text = self.preprocess(
|
let text = self.preprocess(
|
||||||
text.trim_right_matches(|c| c == '\r' || c == '\n'),
|
text.trim_end_matches(|c| c == '\r' || c == '\n'),
|
||||||
&mut cursor_total,
|
&mut cursor_total,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user