Open andychu opened 4 years ago
TODO: measure the performance vs. just clearing a bunch of lines and redrawing them?
I guess it saves bandwidth over SSH.
It looks like there a bunch of TUI libraries in Rust and Go that do this sort of thing:
https://github.com/fdehau/tui-rs (Rust)
The library is based on the principle of immediate rendering with intermediate buffers. This means that at each new frame you should build all widgets that are supposed to be part of the UI. While providing a great flexibility for rich and interactive UI, this may introduce overhead for highly dynamic content. So, the implementation try to minimize the number of ansi escapes sequences generated to draw the updated UI. In practice, given the speed of Rust the overhead rather comes from the terminal emulator than the library itself.
https://github.com/gizak/termui (Go)
I'm not sure how these work:
This can use some help from anyone with experience :)
From https://github.com/oilshell/oil/wiki/How-Interactive-Shells-Work
I think it's a little similar to React or Elm:
https://github.com/dwyl/learn-elm-architecture-in-javascript/issues/2
I think the low level is #682 . Raw hooks. And this is a higher level abstraction. You emit your own events, and those update the model. And then after the changes have propagated, then you diff it and render it in the terminal.