mirror of
https://github.com/sharkdp/bat.git
synced 2025-08-18 03:51:14 +02:00
fix bug where long lines were truncated in plain mode without wrap=never not being set
This commit is contained in:
committed by
David Peter
parent
7ffb04a17a
commit
83c9cb7907
@@ -150,10 +150,10 @@ impl App {
|
||||
wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
|
||||
match self.matches.value_of("wrap") {
|
||||
Some("character") => WrappingMode::Character,
|
||||
Some("never") => WrappingMode::NoWrapping,
|
||||
Some("never") => WrappingMode::NoWrapping(true),
|
||||
Some("auto") | None => {
|
||||
if style_components.plain() {
|
||||
WrappingMode::NoWrapping
|
||||
WrappingMode::NoWrapping(false)
|
||||
} else {
|
||||
WrappingMode::Character
|
||||
}
|
||||
@@ -163,7 +163,7 @@ impl App {
|
||||
} else {
|
||||
// We don't have the tty width when piping to another program.
|
||||
// There's no point in wrapping when this is the case.
|
||||
WrappingMode::NoWrapping
|
||||
WrappingMode::NoWrapping(false)
|
||||
},
|
||||
colored_output: self.matches.is_present("force-colorization")
|
||||
|| match self.matches.value_of("color") {
|
||||
|
@@ -101,7 +101,7 @@ impl OutputType {
|
||||
p.arg("--quit-if-one-screen");
|
||||
}
|
||||
|
||||
if wrapping_mode == WrappingMode::NoWrapping {
|
||||
if wrapping_mode == WrappingMode::NoWrapping(true) {
|
||||
p.arg("--chop-long-lines");
|
||||
}
|
||||
|
||||
|
@@ -424,7 +424,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
}
|
||||
|
||||
// Line contents.
|
||||
if self.config.wrapping_mode == WrappingMode::NoWrapping {
|
||||
if self.config.wrapping_mode == WrappingMode::NoWrapping(false)
|
||||
|| self.config.wrapping_mode == WrappingMode::NoWrapping(true)
|
||||
{
|
||||
let true_color = self.config.true_color;
|
||||
let colored_output = self.config.colored_output;
|
||||
let italics = self.config.use_italic_text;
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum WrappingMode {
|
||||
Character,
|
||||
NoWrapping,
|
||||
NoWrapping(bool), // explicitly opted in or not
|
||||
}
|
||||
|
||||
impl Default for WrappingMode {
|
||||
fn default() -> Self {
|
||||
WrappingMode::NoWrapping
|
||||
WrappingMode::NoWrapping(false)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user