diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index 78a0df69d7..02d91e58f3 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -79,12 +79,18 @@ impl App { pub fn config(&self, inputs: &[Input]) -> Result { let style_components = self.style_components()?; + let extra_plain = self.matches.occurrences_of("plain") > 1; let paging_mode = match self.matches.value_of("paging") { - Some("always") => PagingMode::Always, + Some("always") => { + if extra_plain || self.matches.is_present("no-paging") { + PagingMode::Never + } else { + PagingMode::Always + } + } Some("never") => PagingMode::Never, Some("auto") | None => { // If we have -pp as an option when in auto mode, the pager should be disabled. - let extra_plain = self.matches.occurrences_of("plain") > 1; if extra_plain || self.matches.is_present("no-paging") { PagingMode::Never } else if inputs.iter().any(Input::is_stdin) { diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 4a32de402b..c7cd7985be 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -692,7 +692,7 @@ fn alias_pager_disable_long_overrides_short() { .arg("test.txt") .assert() .success() - .stdout(predicate::eq("pager-output\n").normalize()); + .stdout(predicate::eq("hello world\n").normalize()); } #[test]