Skip to content

Discussion: a builtin pager for 'bat' #1053

@sharkdp

Description

@sharkdp

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 😄
out

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions