dankamongmen / panelreels

high-level objects built atop ncurses
https://nick-black.com/dankwiki/index.php/Outcurses
Apache License 2.0
8 stars 1 forks source link

Implement panelreel arrangement functionality #33

Closed dankamongmen closed 4 years ago

dankamongmen commented 4 years ago

At the core of panelreel (see #4) is the ability to arrange tablets in a finite panel. The proper arrangement is deterministic and unique for a given

For any catastrophic event (say resizing of the reel), we can work out the new reel by starting with the focused tablet, drawing it, placing it, and then working backwards and forwards until the reel is full (the only question here is an unfilled reel, in which case everything might need be translated through the reel's plane).

Discovering the number of lines requires either:

The third option seems superior. Both option 1 and 2 have a fundamental race, where outcurses thinks a tablet can generate some number of lines, but that value has changed by the time outcurses wants to redraw the tablet. This invalidates whatever assumptions outcurses might be leveraging based off its knowledge.

Instead, when moving tablets around, we call into one with:

The callback then draws all it wants, and we take what's useful to us. The only problem is that it might require more redraws than is necessary, since we can't say "this tablet is unchanged; leave what it has there" from outcurses. So long as we ensure the client can do its own quick-validation, though (basically don't destroy or clear the previous panel), we do no extra work.

dankamongmen commented 4 years ago

Current status:

but what we have is working really well!

dankamongmen commented 4 years ago

The last part of this is #60 .