From 1852dea96a9c943db4f36fdd34b61d3d662c52d9 Mon Sep 17 00:00:00 2001 From: abhinavcool42 Date: Thu, 30 Oct 2025 18:42:35 +0530 Subject: [PATCH] Fix --list-themes pager init so less stays interactive --- src/bin/bat/main.rs | 1 + src/output.rs | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs index d489992c..a94b6d23 100644 --- a/src/bin/bat/main.rs +++ b/src/bin/bat/main.rs @@ -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)?; diff --git a/src/output.rs b/src/output.rs index aea37333..0926f2bf 100644 --- a/src/output.rs +++ b/src/output.rs @@ -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);