tenox7 / ttyplot

a realtime plotting utility for terminal/console with data input from stdin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[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.

Closing as fixed by #97 in release 1.5.2; for the undefined behavior as aspect there is dedicated issue #111 by now…