1
0
mirror of https://github.com/sharkdp/bat.git synced 2026-02-08 00:32:08 +00:00

Fix to not show style decorations in auto mode when piping

This commit is contained in:
Keith Hall
2025-11-29 17:32:49 +02:00
parent d17481575a
commit 7d37325c19
3 changed files with 5 additions and 12 deletions

View File

@@ -9,6 +9,7 @@
- Fix hang when using `--list-themes` with an explicit pager, see #3457 (@abhinavcool42)
- Fix negative values of N not being parsed in <N:M> line ranges without `=` flag value separator, see #3442 (@lmmx)
- Fix broken Docker syntax preventing use of custom assets, see #3476 (@keith-hall)
- Fix decorations being applied unexpectedly when piping, breaking cat compatibility. See #3496 (@keith-hall)
## Other
- Improve README documentation on pager options passed to less, see #3443 (@injust)

View File

@@ -384,8 +384,7 @@ impl App {
.map(|s| s.as_str())
== Some("always")
|| self.matches.get_flag("force-colorization")
|| self.matches.get_flag("number")
|| self.matches.contains_id("style") && !style_components.plain()),
|| self.matches.get_flag("number")),
tab_width: self
.matches
.get_one::<String>("tabs")

View File

@@ -415,7 +415,7 @@ fn piped_output_with_line_numbers_style_flag() {
.write_stdin("hello\nworld\n")
.assert()
.success()
.stdout(" 1 hello\n 2 world\n");
.stdout("hello\nworld\n");
}
#[test]
@@ -426,15 +426,7 @@ fn piped_output_with_line_numbers_with_header_grid_style_flag() {
.write_stdin("hello\nworld\n")
.assert()
.success()
.stdout(
"─────┬──────────────────────────────────────────────────────────────────────────
│ STDIN
─────┼──────────────────────────────────────────────────────────────────────────
1 │ hello
2 │ world
─────┴──────────────────────────────────────────────────────────────────────────
",
);
.stdout("hello\nworld\n");
}
#[test]
@@ -452,6 +444,7 @@ fn piped_output_with_auto_style() {
fn piped_output_with_default_style_flag() {
bat()
.arg("--style=default")
.arg("--decorations=always")
.write_stdin("hello\nworld\n")
.assert()
.success()