Save a level of nesting and mental bookkeeping. The control flow was
already jumping within and outside of the loop, so we aren't making this
any more complicated than it already was -- in fact, it's more simple,
because now we also don't have to remember that we're in a 'for' loop.
Was just too long and made navigation difficult. There's no actual
requirement for this procedure to be split out. But it lets us drop 2
levels of indentation and makes navigating up and down main() easier. On
the downside, it breaks up control flow.
Since we changed to use PortMidi's timestamping and buffering stuff,
(because otherwise MIDI timing gets messed up for some people for some
unknown reason), there's now a chance that MIDI notes can get stuck on
when quitting orca, because PortMidi seems to be dumb and won't
immediately send the pending events. So we have to manually spin and
wait for them to be sent. There doesn't appear to be a way to forcefully
flush them, so we're stuck adding an delay.
We need to start breaking more stuff out into subprocedures in order to
reduce code repetition. We already have 'Ged' for the display-layer
agnostic stuff for editing a grid. So we'll add another big struct,
'Tui', which holds the curses-specific stuff.
This commit is only a partial conversion, but it still eliminates so
much redundant code that even after the struct declarations, the line
count is still reduced.