Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Man page paging no longer works #2563

Open
scop opened this issue May 7, 2023 · 3 comments
Open

Man page paging no longer works #2563

scop opened this issue May 7, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@scop
Copy link
Contributor

scop commented May 7, 2023

Commit 57cc0d8 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?

  1. export MANPAGER="sh -c 'col -bx | bat -l man -p'"
  2. 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
@scop scop added the bug Something isn't working label May 7, 2023
@sharkdp
Copy link
Owner

sharkdp commented May 25, 2023

Could this be a duplicate of #2572? (or the other way around)

@m-GDEV
Copy link

m-GDEV commented Sep 2, 2023

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:

screenshot_20230902_194115

Here is my bat --diagnostic:

Software version

bat 0.23.0 (871abd2)

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

@Cheezmeister
Copy link

Cheezmeister commented Jul 28, 2024

I reproduce the latter issue and confirm that setting MANROFFOPT="-c" makes it go away. My man pages are beautiful again 💅 (The original issue I do not repro.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants