
From: Simon Glass <sjg@chromium.org> Some U-Boot commands can produce a lot of output and this can run off top of the display. This series introduces a simple pager feature, to allow the output to be read, before pressing SPACE to continue. A fixed buffer size (4K) is used, which sets a limit on the permmited output before paging fails and the output is simply written all in one lot. In most cases this is plenty, but 'env print' does print the whole environment as one string, so if the legacy distro-boot scripts are used it could happen. The default number of visible lines is set with a Kconfig option. Where a video terminal is being used, the page size is set to match that. In general U-Boot cannot guess the number of visible lines, since a serial terminal may be in use. There is also a 'pager' environment variable which can override any detected value. This initial series only counts newlines. It has no support for counting characters so the result will be sub-optimal if very long lines are written. This could be addressed in a future patch. Future work may detect the terminal size by sending an ANSI sequence. Simon Glass (16): console: Add the basic pager implementation console: Add tests for the basic functionality console: Provide a way to output without the pager console: Rename console-put functions to prepare for pager console: Plumb in the pager console: test: Allow tests to bypass the pager console: Support paging with single characters console: Add a few more paging tests console: Reset the pager when entering a new command console: Implement an environment var to control the pager console: Get the pager lines from the vidconsole efi: Enable the console pager for the app doc: Remove obsolete text in README.console doc: Move console docs to rST doc: Tidy up the console docs a little pager: doc: Add mention of the pager feature common/Kconfig | 20 ++ common/Makefile | 2 + common/cli_readline.c | 13 +- common/console.c | 99 +++-- common/pager.c | 208 +++++++++++ doc/README.console | 100 ------ doc/usage/console.rst | 78 ++++ doc/usage/environment.rst | 8 + doc/usage/index.rst | 1 + include/asm-generic/global_data.h | 11 + include/env_callback.h | 7 + include/pager.h | 178 +++++++++ lib/efi_client/Kconfig | 1 + test/common/Makefile | 1 + test/common/pager.c | 576 ++++++++++++++++++++++++++++++ test/test-main.c | 3 + 16 files changed, 1183 insertions(+), 123 deletions(-) create mode 100644 common/pager.c delete mode 100644 doc/README.console create mode 100644 doc/usage/console.rst create mode 100644 include/pager.h create mode 100644 test/common/pager.c -- 2.43.0 base-commit: 96d39714e407ff11177434b835ab1a7d46c8c695 branch: cli