Skip to content

Conversation

ianthomas23
Copy link
Member

The start of a terminal pager for various git2cpp commands, initially enabled for log subcommand. Fixes #45.

pager.mp4

Supports the following keys to navigate:

d, space                   scroll down a page
u                          scroll up a page
q                          quit pager
down arrow, enter, return  scroll down a line
up arrow                   scroll up a line

If cout is not to a tty or the output is short enough to fit within a single page the pager is not used.

Still to do, probably in separate PRs:

  • Gracefully deal with lines that are longer than the terminal width.
  • Searching by regex.

To add to other subcommands, see how it is used in log_subcommand.cpp. The terminal_pager constructor does the required initialisation, and it displays on the show call. I suppose I could have done the show automatically in the destructor but that didn't seem a good idea.

Awaiting a new release of JupyterLite before we can easily try it in the terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement pager for log and status commands
1 participant