Shorten tty output when terminal is too small #10168
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Laura Brehm laurabrehm@hey.com
We've had lots of complaints about the new TUI breaking when output exceeds terminal height. Related discussion can be found in these issues:
The issue was partly addressed by the changes to detect when multiple services use the same images in #9173, but the root issue persists. Whenever have more lines to write than the terminal height, we're unable to scroll back far enough to rewrite the buffer, and leave dangling lines behind, filling up the terminal scrollback and resulting in bad UX.
What I did
Detect when the number of events we have to display is > than terminal height, and adjust the output to omit child events when that's the case. This isn't a perfect solution (if the number of services > terminal height we will still run into issues, and the shortened output isn't very explicit), but it only kicks in in cases where the output would otherwise be worse, so it's an improvement over the current situation.
Before:
Screen.Recording.2023-01-12.at.01.20.16.mov
After:
Screen.Recording.2023-01-12.at.01.22.00.mov
(not mandatory) A picture of a cute animal, if possible in relation to what you did