Respect paging mode for list languages

This commit is contained in:
cyphercodes committed 2026-07-04 06:31:26 +03:00
1 parent 78951393e2
commit 218afc30ac
3 files changed
+15 -10

No files matched your search

+1
View File
@@ -23,6 +23,7 @@
- Syntax highlighting for Python files using uv as script runner in shebang #3689 (@janlarres) - Syntax highlighting for Python files using uv as script runner in shebang #3689 (@janlarres)
## Bugfixes ## Bugfixes
- Fix `--list-languages` respecting `--paging=never`, see #3828 (@cyphercodes)
- `--strip-ansi`: also strip 8-bit C1 introducers (U+0090, U+0098, U+009B, U+009D, U+009E, U+009F) and DCS/SOS/PM/APC sequence bodies, which previously passed through. See #3729 (@curious-rabbit) - `--strip-ansi`: also strip 8-bit C1 introducers (U+0090, U+0098, U+009B, U+009D, U+009E, U+009F) and DCS/SOS/PM/APC sequence bodies, which previously passed through. See #3729 (@curious-rabbit)
- Fix `--ignored-suffix` not falling back to first-line/shebang detection when the ignored suffix is also a registered extension (e.g. `--ignored-suffix .txt` on a shebang script), see #2745 and #3816 (@adnrivera) - Fix `--ignored-suffix` not falling back to first-line/shebang detection when the ignored suffix is also a registered extension (e.g. `--ignored-suffix .txt` on a shebang script), see #2745 and #3816 (@adnrivera)
- Fix `capacity overflow` panic when printing a snip separator at `--terminal-width=1` with multiple line ranges. Closes #3803, see #3804 (@leeewee) - Fix `capacity overflow` panic when printing a snip separator at `--terminal-width=1` with multiple line ranges. Closes #3803, see #3804 (@leeewee)
+3 -5
View File
@@ -427,11 +427,9 @@ fn run() -> Result<bool> {
if app.matches.get_flag("list-languages") { if app.matches.get_flag("list-languages") {
let languages: String = get_languages(&config, cache_dir)?; let languages: String = get_languages(&config, cache_dir)?;
let inputs: Vec<Input> = vec![Input::from_reader(Box::new(languages.as_bytes()))]; let inputs: Vec<Input> = vec![Input::from_reader(Box::new(languages.as_bytes()))];
let plain_config = Config { let mut plain_config = config.clone();
style_components: StyleComponents::new(StyleComponent::Plain.components(false)), plain_config.style_components =
paging_mode: PagingMode::QuitIfOneScreen, StyleComponents::new(StyleComponent::Plain.components(false));
..Default::default()
};
run_controller(inputs, &plain_config, cache_dir) run_controller(inputs, &plain_config, cache_dir)
} else if app.matches.get_flag("list-themes") { } else if app.matches.get_flag("list-themes") {
list_themes(&config, config_dir, cache_dir, app.theme_options())?; list_themes(&config, config_dir, cache_dir, app.theme_options())?;
+11 -5
View File
@@ -626,12 +626,18 @@ fn list_themes_to_piped_output() {
} }
#[test] #[test]
#[serial]
fn list_languages() { fn list_languages() {
bat() mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
.arg("--list-languages") bat()
.assert() .env("PAGER", mocked_pagers::from("echo pager-output"))
.success() .arg("--list-languages")
.stdout(predicate::str::contains("Rust").normalize()); .arg("--paging=never")
.assert()
.success()
.stdout(predicate::str::contains("Rust").normalize())
.stdout(predicate::str::contains("pager-output").not());
});
} }
#[test] #[test]