mirror of
https://github.com/sharkdp/bat.git
synced 2026-10-26 20:16:33 +00:00
remove code comments
This commit is contained in:
1 parent
16d041492c
commit
62b0388236
2 files changed
-10
No files matched your search
@@ -400,7 +400,6 @@ impl App {
|
|||||||
_ => unreachable!("other values for --binary are not allowed"),
|
_ => unreachable!("other values for --binary are not allowed"),
|
||||||
},
|
},
|
||||||
wrapping_mode: {
|
wrapping_mode: {
|
||||||
// Check for explicit flags first (--chop-long-lines or --wrap)
|
|
||||||
if self.matches.get_flag("chop-long-lines") {
|
if self.matches.get_flag("chop-long-lines") {
|
||||||
WrappingMode::NoWrapping(true)
|
WrappingMode::NoWrapping(true)
|
||||||
} else {
|
} else {
|
||||||
@@ -408,7 +407,6 @@ impl App {
|
|||||||
Some("character") => WrappingMode::Character,
|
Some("character") => WrappingMode::Character,
|
||||||
Some("never") => WrappingMode::NoWrapping(true),
|
Some("never") => WrappingMode::NoWrapping(true),
|
||||||
Some("auto") | None => {
|
Some("auto") | None => {
|
||||||
// For "auto" or default mode, respect interactive_output setting
|
|
||||||
if self.interactive_output || maybe_term_width.is_some() {
|
if self.interactive_output || maybe_term_width.is_some() {
|
||||||
if style_components.plain() && maybe_term_width.is_none() {
|
if style_components.plain() && maybe_term_width.is_none() {
|
||||||
WrappingMode::NoWrapping(false)
|
WrappingMode::NoWrapping(false)
|
||||||
|
|||||||
@@ -2884,15 +2884,11 @@ fn no_wrapping_with_chop_long_lines() {
|
|||||||
wrapping_test("--chop-long-lines", false);
|
wrapping_test("--chop-long-lines", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regression test for issue #3587: --wrap=never should be respected when paging is enabled
|
|
||||||
// The fix ensures that bat respects the --wrap=never flag even when output is piped to a pager
|
|
||||||
// by passing the -S flag to less to disable wrapping in the pager
|
|
||||||
#[test]
|
#[test]
|
||||||
#[serial]
|
#[serial]
|
||||||
fn wrap_never_flag_respected_with_paging_always() {
|
fn wrap_never_flag_respected_with_paging_always() {
|
||||||
mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
|
mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
|
||||||
bat()
|
bat()
|
||||||
// Use cat as pager to pass through the output (avoiding the echo pager issue)
|
|
||||||
.arg("--pager=cat")
|
.arg("--pager=cat")
|
||||||
.arg("--paging=always")
|
.arg("--paging=always")
|
||||||
.arg("--wrap=never")
|
.arg("--wrap=never")
|
||||||
@@ -2902,19 +2898,16 @@ fn wrap_never_flag_respected_with_paging_always() {
|
|||||||
.write_stdin("abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz\n")
|
.write_stdin("abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz\n")
|
||||||
.assert()
|
.assert()
|
||||||
.success()
|
.success()
|
||||||
// With --wrap=never and cat pager, the line should NOT wrap
|
|
||||||
.stdout(predicate::str::contains("abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz").normalize())
|
.stdout(predicate::str::contains("abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz").normalize())
|
||||||
.stderr("");
|
.stderr("");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regression test for issue #3587: -S flag should be respected when paging is enabled
|
|
||||||
#[test]
|
#[test]
|
||||||
#[serial]
|
#[serial]
|
||||||
fn s_flag_respected_with_paging_always() {
|
fn s_flag_respected_with_paging_always() {
|
||||||
mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
|
mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
|
||||||
bat()
|
bat()
|
||||||
// Use cat as pager to pass through the output
|
|
||||||
.arg("--pager=cat")
|
.arg("--pager=cat")
|
||||||
.arg("--paging=always")
|
.arg("--paging=always")
|
||||||
.arg("-S")
|
.arg("-S")
|
||||||
@@ -2924,7 +2917,6 @@ fn s_flag_respected_with_paging_always() {
|
|||||||
.write_stdin("abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz\n")
|
.write_stdin("abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz\n")
|
||||||
.assert()
|
.assert()
|
||||||
.success()
|
.success()
|
||||||
// With -S flag and cat pager, the line should NOT wrap
|
|
||||||
.stdout(predicate::str::contains("abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz").normalize())
|
.stdout(predicate::str::contains("abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz").normalize())
|
||||||
.stderr("");
|
.stderr("");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user