1
0
mirror of https://github.com/sharkdp/bat synced 2026-06-09 10:03:18 +00:00

Merge branch 'master' into feat/diff-plain-compatibility

This commit is contained in:
Keith Hall
2026-03-21 16:21:56 +02:00
committed by GitHub
5 changed files with 36 additions and 7 deletions
Binary file not shown.
+19
View File
@@ -2681,6 +2681,25 @@ fn binary_as_text() {
.stderr("");
}
#[test]
fn binary_as_text_control_char_width() {
// Control characters are displayed as caret notation (e.g. ^@) by the
// terminal, occupying 2 columns each. With 20 NUL bytes (40 columns) +
// "END" (3 columns) = 43 columns, wrapping at terminal width 40 must
// produce 2 lines, not 1. See #3631.
bat()
.arg("--binary=as-text")
.arg("--wrap=character")
.arg("--terminal-width=40")
.arg("--decorations=always")
.arg("--style=plain")
.arg("--color=never")
.arg("regression_tests/issue_3631.txt")
.assert()
.success()
.stdout(predicate::function(|s: &str| s.lines().count() == 2));
}
#[test]
fn no_strip_overstrike_for_plain_text() {
// Overstrike is preserved for plain text files (no syntax highlighting)