stdlib-js/stdlib

[RFC]: add `help()` documentation pager in REPL

Snehil-Shah opened this issue · 1 comments

Description

This RFC proposes adding pagination abilities to the help() text output. Help documentation can be long. Currently when executed, scrolls the terminal till the end of the documentation, the user has to then manually scroll to the beginning of the output to start reading, leading to bad UX.

I made a working prototype of the design I had in mind (attached below):

pager.1.mp4

Will make a PR once I have a clearer goal of what design are we trying to implement.

Related Issues

Related issue stdlib-js/google-summer-of-code#1

Questions

Is the design of the prototype shared above good? It allows paging in place rather than clearing the whole page (as we have with the less command). The above pager is only triggered if the help text is longer than the terminal height. I feel this is better suited for a REPL than a less type of behavior as we stay in the REPL when paging.

Other

As mentioned here, there has been prior attempts at adding a pager. Can I get some idea of the approach that was taken before to solve this, as I am not sure if my current approach is the best way to do this... Some prior context would be helpful here.

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.

@kgryte I was also wondering if we could extend it to paginating all outputs that are taller than the terminal rather than just the help documentation? (controllable by a setting). can be helpful in cases like reading a file (using readFile) etc.