bat: man page display does not work correctly
Please notice that is is different from #2563 and different man colorization bugs where escape color codes are not interpreted.
What steps will reproduce the bug?
This is how man ls looks in most:
Now let’s run PAGER="bat --style snip --theme gruvbox-dark" man ls.
Notice two problems:
lsoption line is broken in the middle ofcolor.- Highlighting is broken.
The plain style looks a little bit better: the option line is not broken, but the highlighting is:
If the --style option is omitted, there is still an erroneous line break. I was not able to get any changes by using a different colorscheme.
Bat was installed via cargo.
❯ bat --style plain --theme gruvbox-dark --diagnostic
Software version
bat 0.23.0
Operating system
freebsd 13.2-RELEASE
Command-line
bat --style plain --theme gruvbox-dark --diagnostic
Environment variables
SHELL=/usr/local/bin/bash
PAGER=most
LESS=<not set>
LANG=ru_RU.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=zenburn
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=<not set>
NO_COLOR=<not set>
MANPAGER=<not set>
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/alexey/.config/bat/config’: No such file or directory (os error 2).
Custom assets metadata
Could not read contents of ‘/home/alexey/.cache/bat/metadata.yaml’: No such file or directory (os error 2).
Custom assets
‘/home/alexey/.cache/bat’ not found
Compile time information
- Profile: release
- Target triple: x86_64-unknown-freebsd
- Family: unix
- OS: freebsd
- Architecture: x86_64
- Pointer width: 64
- Endian: little
- CPU features: fxsr,sse,sse2
- Host: x86_64-unknown-freebsd
Less version
> less --version
less 608 (POSIX regular expressions)
Copyright (C) 1984-2022 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
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 2
- Comments: 15
Commits related to this issue
- bat as MANPAGER was mangling output See https://github.com/sharkdp/bat/issues/2593#issuecomment-1636468711 — committed to JoshMock/dotfiles by JoshMock a year ago
- fix(bat): workaround for man page color error see: https://github.com/sharkdp/bat/issues/2593 — committed to latipun7/dotfiles by latipun7 a year ago
- [profile] Fix man page formatting with bat Observed on Arch after man/roff update. Set MANROFFOPT as described: * https://github.com/sharkdp/bat/issues/2568 * https://github.com/sharkdp/bat/issues/25... — committed to mliszcz/dotfiles by mliszcz 8 months ago
Same problem as @christianhauff. EDIT: Apparently the culprit is groff v1.23, so I added this to .zshrc and .bashrc
export MANROFFOPT='-c'I don’t know what this actually does, but it seems to work.I guess I’m following up here with a related issue. I’ve been using the MANPAGER-Snippet from the readme for several months now, and since some software updates two days ago, my manpages have some gibberish characters included:
When investigating, i found that
col(included inutil-linux) got updated exactly around that time and seems to behave differently, has anyone else experienced that too?For myself, using bat-extras & less, this is how I could get proper coloring:
@ju1ius , thanks. I found this solution in the gnu groff forum, only to find it was documented in the bat readme all along!
Thanks @mjd-tech, your workaround works for me !