Skip to content

fix: disable paging when listing themes - #3843

Open
Deen3303 wants to merge 2 commits into
sharkdp:masterfrom
Deen3303:master
Open

fix: disable paging when listing themes#3843
Deen3303 wants to merge 2 commits into
sharkdp:masterfrom
Deen3303:master

Conversation

@Deen3303

Copy link
Copy Markdown

Problem

If a user has global paging options configured (for example, via 'BAT_OPTS="--paging=always"' or inside their global configuration file), running 'bat --list-themes' will attempt to pipe the theme list through the pager.

Because of how the theme preview blocks are printed, this forces the pager to display them one by one, rendering the list completely unusable and swallowing the theme header names.

Solution

This PR intercepts the execution flow in 'src/bin/bat/main.rs' right before executing the 'list_themes' command.

Specifically:

  1. Create a local mutable copy of the resolved configuration (config) inside the 'list-themes' block.
  2. Explicitly override 'paging_mode' to 'bat::PagingMode::Never'.
  3. Pass this modified configuration to the 'list_themes' function.

This forces 'bat' to print the entire list of themes cleanly to standard output, ignoring any global paging configurations, while leaving normal file-viewing behaviors completely untouched.

Verification

Tested locally by setting:
$env:BAT_OPTS="--paging=always"
.\target\debug\bat.exe --list-themes
(Printed cleanly)
batfix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant