Option not to clear terminal when output height larger than the screen #621
Replies: 1 comment
-
|
I also ran into this issue and had a bit of a think about how this could be solved. This is my idea/proposal. There's a table summarizing it at the bottom. If there's interest in this approach, I'm happu to try to come up with a proof of concept (proably not within ink's implementation though). The implementation would provide two modes of operation. There would need to be way for the application to select one mode (probably best before calling
The main changes to the current implementation:
There are some considerations necessary regarding static output:
Terminating:
(1): This can't be done immediately and has to be buffered until the application terminates. Otherwise, terminals without support for Synchronized Output would experience severe flickering (but see Summary
(2): Output written via (3): An alternative would be to add static output to the top of the alternate screen and allowing the user to scroll into it. This would make the behavior equivalent to the current implementation while the application is running. (4): An alternative would be to write a full copy of the UI into the main screen on exit. Then the behavior would be equivalent to the current implementation when the application exits. Extensions
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I have a command that sometimes makes use of the entire screen width and height. I can limit the output by checking
process.stdout.rows(andcols) but apparently I can't react quickly enough when the terminal size changes, for instance when using window splitting in Kitty. So inevitably I'm running into the issue described here:#382 Terminal history cleared if output is greater than height of terminal window
The thing is that my command's users can live with a little defective output. I also compared it to
docker compose pullwhich downloads Docker images for many services and it dynamically updates many lines with progress information. It tries to make sure everything fits on the screen, but if I resize its terminal window, it produces some borked output for a moment and then everything goes back to normal. The bad output stays there after the command is done, but it's not a big deal.I tried commenting out the block where Ink clears the screen when
outputHeight >= this.options.stdout.rowsand it worked just like with Docker Compose, some glitches for a moment and then everything back to normal.I think It's a valid use case for some applications and there could be an option to disable clearing scrollback at the cost of potential glitches (with a warning in the documentation). I'm not yet familiar with Ink's code, but if current contributors aren't too enthusiastic about this use case, I can work on it. Would you be interested in a PR, @vadimdemedes?
Beta Was this translation helpful? Give feedback.
All reactions