Add support for pressing 'Q' to put the pager into bypass mode,disabling
further paging for the current session.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
The pager should be bypassed if the terminal was not detected. Fix the
condition which actually says the opposite.
Also fix a long line in pager_post()
Signed-off-by: Simon Glass <sjg@chromium.org>
The 'pager' environment variable can be used to set the number of lines
on the display. Provide a callback for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
We don't want the pager appearing when entering commands, so add a way
to bypass it. Reset the line count to zero before executing the command.
Signed-off-by: Simon Glass <sjg@chromium.org>
We generally don't want the pager to be active when running tests,
since U-Boot appears to hang forever. Perhaps we could detect when the
tests are being run interactively and use the pager in that case. But
for now, just bypass it.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Sometimes output should be sent ignoring the pager, such as when it is
a message related to paging. Add a parameter to support this.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add an implementation of the pager. It has quite a simple API:
- call pager_post() to send some output, which returns what should
actually be sent to the console devices
- then call pager_next() repeatedly, outputting what it returns,
until it returns NULL
There is one special case: pager_next() returns PAGER_WAITING if it is
waiting for the user to press a key. In that case, the caller should
read a key and then pass it to the next pager_next() call.
Internally, there is a simple state machine to cope with hitting the
limit (and outputing a prompt), waiting for the user and the clearing
the prompt, before continuing in the normal PAGEST_OK state.
Signed-off-by: Simon Glass <sjg@chromium.org>