[1.5.1] Minimum window size assumptions can be violated?
hartwork opened this issue · comments
Hi!
From a user point of view, resizing ttyplot's window to small sizes and back can get ttyplot into a broken state, e.g. see video below.
From a code point of view, there are multiple places where a certain minimum size is assumed…
plotheight=height-4;
(width/2)-14
(width/2)-(strlen(title)/2)
…but not checked for. So the assumptions can be violated in practice, e.g. during a resize.
python-prompt-toolkit addresses this problem by displaying something like "window too small" whenever that's the case (and the window is big enough for that text still). I think that would be great to have here for robustness, too.
What do you think?
PS: This may or may not be related to #77.
recording-2023-03-14_04.42.01.mp4
Yeah great idea thank you!
This is still broken with latest 1.5.1. I'll adjust the title accordingly…
It turns that /dev/random
triggers multiple things — including undefined behavior — needs more investigation.
For the simple part — displaying a message when then window is too small — pull request #97 is now ready for review.