You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's use this ticket to discuss some ideas and possible upsides/downsides of writing our own custom pager library that we could use instead of calling an external $PAGER process (or, essentially, less).
A few advantages if we would use a builtin pager in bat:
General advantages of a "pager" as a library (not just for bat):
Make everything easily configurable: custom header and footer messages, keybindings
Bidirectional communication: send events like "terminal resize" or key presses back to the main application to trigger a redraw or other actions.
The obvious downsides are:
this will be a lot of work 😄
I'm sure there will be TONS of bug reports regarding obscure terminal emulators and operating systems where things are not working as expected - which results in even more work. less comes with 36 years(!!) of experience.
One way to circumvent the second point would be to make this an opt-in feature, at least in the beginning.
I have actually started to implement a really simple cross-platform pager-as-a-library like this in a private repository. The first results look promising 😄
I'd be happy to hear about your thoughts and ideas!
Let's use this ticket to discuss some ideas and possible upsides/downsides of writing our own custom pager library that we could use instead of calling an external
$PAGERprocess (or, essentially,less).A few advantages if we would use a builtin pager in
bat:less. Consistent "quit if one screen" handling, and much more (Default pager breaks colours in Windows Terminal #860, Garbage unicode chars on wide screen display #1000, Can't open Dockerfile or .dockerfile #717, Bat does not work as file viewer for Midnight Commander for small files #710, pager="less -RF" breaks on macOS for single-page, but default pager breaks pgup/pgdn #681, File content not printed #520, Bat quickly exits #415, Bat with BAT_PAGER set doesn't work on small files #312, Always displays escape characters #271, Horizontal line wraps ifless --status-columnis used as pager #519, Width is wrong when using less as pager with -J option #376, Since recent update, short files that do not require paging are displayed and then lost #887, Bat opens a file and close it itself in a second on Windows #943, Can't view some files #838, …)vcommand does not work with a file as arg #528, Cannot edit standard input (Press RETURN) #697, Have the ability to open a vim session from bat (like less) #1051, Open file withv, like withless#1607)--followsupport (Addfollowoption #457, Pass in "Ctrl-C" to pager? #808)--tabsshould be 0 by default instead of 4 #980, --tabs 0 is realy 8 #894)General advantages of a "pager" as a library (not just for
bat):The obvious downsides are:
lesscomes with 36 years(!!) of experience.One way to circumvent the second point would be to make this an opt-in feature, at least in the beginning.
I have actually started to implement a really simple cross-platform pager-as-a-library like this in a private repository. The first results look promising 😄

I'd be happy to hear about your thoughts and ideas!