Scrolling rendered aka "CLI" mode, ideally a replacement for direct mode #1853
Replies: 3 comments 23 replies
-
Alright, I've put a chunk of thought into this, and think I have a good plan. I'll be calling this "CLI mode" for want of a better name. I think of TUIs as fullscreen deals, and CLIs as scrolling and working exclusively with stdin/stdout. CLIs are things you can (sometimes) pipe, pipes being best used with streams and CLI being a newline-delimited stream. A (roughly) fundamental property of streams: you're not going backwards. A (roughly) fundamental property of terminals: you're not scrolling up (these both have exceptions, as will we). I'd call it "line mode", except we're not really working with lines, just turning on them. Remember, CLI mode still does not happily coexist with other programs freely generating output. Unlike direct mode, everything must be run through Notcurses. We will, however, provide for some recovery in the event of wayward output. There is no single bit that says "CLI mode". There are a set of existing behaviors which, following some refinement, can be sensibly composed to achieve this goal. The prototypical CLI-style Notcurses application will:
Of these, scrolling standard plane and The standard plane remains how it is -- always having geometry equal to the visual area, always with its origin matching that of the visual area, and always present. That's fundamental, because actions taken relative to the standard plane (when it is in scrolling mode) can be interpreted as actions against the visual area.
|
Beta Was this translation helpful? Give feedback.
-
I think we ought document that people using CLI mode probably want to use |
Beta Was this translation helpful? Give feedback.
-
@klamonte (as always) has a lot of good thoughts on this at https://gitlab.com/klamonte/jexer/-/issues/75. in particular:
and
so i think this is going to be pretty important. with that said, if we can truly bring the full power of Notcurses to bear, we're going to be able to unleash the most kick-ass command line tools ever seen. |
Beta Was this translation helpful? Give feedback.
-
#1823 gave us the ability to scroll in rendered mode, by setting the default plane to scroll. Together with retrieving the cursor position at startup and preserving it as a logical scroll, this gives us the ability to write scrolling CLI-like (as opposed to TUI-like) applications in rendered mode. This means the full power of rendered mode can be brought to bear, and ideally that Direct Mode might one day be cast off into the lands of backwards compatibility (maybe not -- scrolling rendered mode still doesn't want other sources emitting output).
The first major problem I can see is
stderr
. Anything dropped ontostderr
is still going to screw us, and Notcurses can do that itself on errors (or with a highloglevel
, because it's Tuesday). But maybe we just say, yep, as always, you can't interleave other output freely. idkWhat else? #1837 hasn't been particularly reassuring, though any such new technique will need a few bugs shaken out.
Beta Was this translation helpful? Give feedback.
All reactions