bat
bat copied to clipboard
Man page paging no longer works
Commit 57cc0d843567eef566540074b391f8212d859871 breaks paging in man
output. Before that change, the MANPAGER
recipe resulted in nice colored and paged man
output; after that, the paging is gone.
Adding --paging=always
to MANPAGER
serves as a workaround, but I'm assuming this is an inadvertent change because it's not mentioned in the changelog and the man recipe has not been updated with this.
I tried updating is-terminal
to 0.4.7, but it had no effect on this.
What steps will reproduce the bug?
-
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
-
man man
What happens?
The entire man page scrolls through to the end.
What did you expect to happen instead?
Paged output.
How did you install bat
?
Built from git.
bat version and environment
--diagnostic
does not play well with the MANPAGER
setup, but here's the raw bat --diagnostic
output.
Software version
bat 0.23.0 (e828d78)
Operating system
Linux 5.15.0-67-generic
Command-line
bat --diagnostic
Environment variables
SHELL=/bin/bash
PAGER=less
LESS=-iMR
LANG=en_GB.UTF-8
LC_ALL=<not set>
BAT_PAGER=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER='sh -c '\''col -bx | bat -l man -p'\'''
System Config file
Could not read contents of '/etc/bat/config': No such file or directory (os error 2).
Config file
--pager="less -R"
--theme=Dracula
Custom assets metadata
Could not read contents of '/home/scop/.cache/bat/metadata.yaml': No such file or directory (os error 2).
Custom assets
'/home/scop/.cache/bat' not found
Compile time information
- Profile: release
- Target triple: x86_64-unknown-linux-gnu
- Family: unix
- OS: linux
- Architecture: x86_64
- Pointer width: 64
- Endian: little
- CPU features: fxsr,sse,sse2
- Host: x86_64-unknown-linux-gnu
Less version
> less --version
less 551 (GNU regular expressions)
Copyright (C) 1984-2019 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: http://www.greenwoodsoftware.com/less
Could this be a duplicate of https://github.com/sharkdp/bat/issues/2572? (or the other way around)
Update
After some more research I found a solution by using MANROFFOPT="-c"
as an env variable. Got this from #2568. Wanted to leave this here in case anybody else find it. Thanks.
I'm also having an issue with bat not being able to correctly handle man pages.
The paging functionality does work but it seems as if the color functionality does not fully work. Might have something to do with ANSI escape codes.
I've looked into some other issues with the man pager functionality and this seems to come the closest to my issue. I think it might be possible this functionality was also broken in the recent updated.
Here is my manpager env variable:
MANPAGER="sh -c 'col -bx | bat -l man -p'"
Here is the output of man grep
:
Here is my bat --diagnostic
:
Software version
bat 0.23.0 (871abd27)
Operating system
Linux 6.4.6-arch1-1
Command-line
bat --diagnostic
Environment variables
SHELL=/bin/bash
PAGER=<not set>
LESS=<not set>
LANG=en_CA.UTF-8
LC_ALL=<not set>
BAT_PAGER=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER='sh -c '\''col -bx | bat --style=plain -l man -p'\'''
System Config file
Could not read contents of '/etc/bat/config': No such file or directory (os error 2).
Config file
Could not read contents of '/home/musa/.config/bat/config': No such file or directory (os error 2).
Custom assets metadata
Could not read contents of '/home/musa/.cache/bat/metadata.yaml': No such file or directory (os error 2).
Custom assets
'/home/musa/.cache/bat' not found
Compile time information
- Profile: release
- Target triple: x86_64-unknown-linux-gnu
- Family: unix
- OS: linux
- Architecture: x86_64
- Pointer width: 64
- Endian: little
- CPU features: fxsr,sse,sse2
- Host: x86_64-unknown-linux-gnu
Less version
> less --version
less 633 (PCRE2 regular expressions)
Copyright (C) 1984-2023 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less