git --help breaks with bat manpager
What steps will reproduce the bug?
MANPAGER="sh -c 'col -bx | bat -l man -p'" git commit --help- observe
What happens?
The bolded text is misformatted:
What did you expect to happen instead?
The text to appear fine
How did you install bat?
pacman
bat version and environment
Software version
bat 0.24.0 (fc954685)
Operating system
Linux 6.5.7-arch1-1
Command-line
bat --diagnostic
Environment variables
SHELL=/usr/bin/fish
PAGER=<not set>
LESS=<not set>
LANG=en_US.UTF-8
LC_ALL=<not set>
BAT_PAGER=<not set>
BAT_PAGING=<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
Could not read contents of '/home/user/.config/bat/config': No such file or directory (os error 2).
Custom assets metadata
Could not read contents of '/home/user/.cache/bat/metadata.yaml': No such file or directory (os error 2).
Custom assets
'/home/user/.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 643 (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
Interesting, that exact same invocation works fine for me with no spurious 4m etc stuff in the output. Just as a quick sanity check, does it make a difference with --pager=never in the mix? i.e. MANPAGER="sh -c 'col -bx | bat -l man -p --pager=never'" git commit --help
I just tried it and no, it's the highlighting that's messing up, not the pager
groff version? If 1.23.0, adding MANROFFOPT='-c' will probably fix the output.
cf. https://github.com/sharkdp/bat/issues/2593#issuecomment-1636468711
groff version? If 1.23.0, adding
MANROFFOPT='-c'will probably fix the output.cf. #2593 (comment)
Running MANPAGER="sh -c 'col -bx | bat -l man -p'" MANROFFOPT='-c' git commit --help fixes it, thanks for help. Perhaps this should be added in the README?
$ groff -v
GNU groff version 1.23.0
Copyright (C) 2022 Free Software Foundation, Inc.
GNU groff comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of groff and its subprograms
under the terms of the GNU General Public License.
For more information about these matters, see the file
named COPYING.
called subprograms:
GNU grops (groff) version 1.23.0
GNU troff (groff) version 1.23.0
Running
MANPAGER="sh -c 'col -bx | bat -l man -p'" MANROFFOPT='-c' git commit --helpfixes it, thanks for help. Perhaps this should be added in the README?
It has already been added in README.md, about 4 years ago (#45f3c733)!