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

Fix --list-themes pager init so less stays interactive

This commit is contained in:
abhinavcool42
2025-10-30 18:42:35 +05:30
parent a8140f91cc
commit 1852dea96a
2 changed files with 12 additions and 9 deletions

View File

@@ -205,6 +205,7 @@ pub fn list_themes(
style.insert(StyleComponent::Plain);
config.language = Some("Rust");
config.style_components = StyleComponents(style);
config.paging_mode = PagingMode::Always;
let mut output_type =
OutputType::from_mode(config.paging_mode, config.wrapping_mode, config.pager)?;

View File

@@ -141,16 +141,18 @@ impl OutputType {
//
// For newer versions (530 or 558 on Windows), we omit '--no-init' as it
// is not needed anymore.
match retrieve_less_version(&pager.bin) {
None => {
p.arg("--no-init");
if single_screen_action == SingleScreenAction::Quit {
match retrieve_less_version(&pager.bin) {
None => {
p.arg("--no-init");
}
Some(LessVersion::Less(version))
if (version < 530 || (cfg!(windows) && version < 558)) =>
{
p.arg("--no-init");
}
_ => {}
}
Some(LessVersion::Less(version))
if (version < 530 || (cfg!(windows) && version < 558)) =>
{
p.arg("--no-init");
}
_ => {}
}
} else {
p.args(args);