-
Notifications
You must be signed in to change notification settings - Fork 346
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
Add pager #672
Add pager #672
Conversation
Yes, I think the goal should be to route
Yes, that's what Mercurial does. For many commands (e.g.
Mercurial lets the commands decide when to enable the pager (if it's configured to be used). That should remove the need for a temporary buffer. |
We should stream output directly to the pager rather than buffering it up in full first. A file descriptor (or |
Yep, I lied in the chat, sorry. If we need line-buffered output (like stdout), I think |
1afc334
to
11f689d
Compare
Ok this is ready for review again :) |
2dc4f2f
to
6ef8312
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely deserves a mention in the changelog! Probably also worth mentioning in docs/config.md.
We'll add a variant that isn't a pair. Also add a function to create a new UiOutput::Terminal, we will create this variant in a few places because we want to fall back to it.
Teach Ui's writing functions to write to a pager without touching the process's file descriptors. This is done by introducing UiOutput::Paged, which spawns a pager that Ui's functions can write to. The pager program can be chosen via `ui.pager`. (defaults to Defaults to $PAGER, and 'less' if that is unset (falling back to 'less' also makes the tests pass). Currently, commands are paginated if: - they have "long" output (as defined by jj developers) - jj is invoked in a terminal The next commit will allow pagination to be turned off via a CLI option. More complex pagination toggling (e.g. showing a pager even if the output doesn't look like a terminal, using a pager for shorter ouput) is left for a future PR.
In a future PR, I want to be able to paginate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Add pager support via the following config variables:
'always' and 'never'. Defaults to 'auto'.
Support for the
--pager
(or should it be called--paginate
?) flag is WIP.Checklist
If applicable:
CHANGELOG.md