3 ms·
DomTerm (https://domterm.org/ https://domterm.org/) solves part of the puzzle. See https://domterm.org/saved/dt-prettynested.html https://domterm.org/saved/dt-p
by Per_Bothner 6y ago
DomTerm (https://domterm.org/ https://domterm.org/) solves part of the puzzle.
See https://domterm.org/saved/dt-prettynested.html https://domterm.org/saved/dt-prettynested.html for a "live screenshot" - it's a capture of a bash+KawaScheme session, but with some JavaScript so it is still responsive.
In addition to the highlighting of input vs prompt, note the little triangles which allow you to hide parts of the output. Try it - it's live. The triangles at the right of the screen are emitted by bash (see instructions here https://domterm.org/Shell-prompts.html https://domterm.org/Shell-prompts.html) or the Kawa Scheme REPL. The triangles elsewhere are emitted by the application (PrintNested or Kawa) to display a nested data structure. Note the latter does dynamic pretty-printing - re-size the window and the line-breaks are recalculated by JavaScript in a way that shows the logical structure of the output. (This is done by the application sending some special escape sequences with the output. The escape sequences are recorded on the DomTerm data structure, and handle re-flow for commands that are dead.)
Also notice the support for nested command groups: Clicking the button by the "kawa" (shell) command hides all the non-initial lines from the Kawa command, while buttons by individual Kawa input lines just hide that Kawa command.
What I'd like to add is a hook for the "job" feature of various shells. When you put a job into the background, it would hide the output from the command, which would continue to produce hidden output. The shell would emit a new prompt for a new command. All background jobs could be made visible at the same the (if you want) by clicking the show/hide triangles, and hidden by re-clicking.
One way a shell could do this is by creating a new pty when creating a new job. DomTerm could be set up to interleave the output front different ptys. (DomTerm could build on its "buffer" model, which extends the xterm main/alternate buffer model. DomTerm supports an arbitrary number of buffers, which are displayed one below the other. Interleaving pty could build on this by tying each pty to a new buffer.)