This actually doesn't implement reflow but I wanted to merge this
because it has an important refactor and clarity around screen
operations.
It is now clearly defined in the API what portion of the screen you're
accessing (active, viewport, etc.) and the terminal only operates on the
active area (fixing TODO item in diff).
This is all groundwork I found was necessary to even start thinking
about reflow.
This fixes tons of bugs around escape sequences while scrolling that
used to work on the offset from the viewport (which is wrong). This now
calculates the actual active area and does that. This also fixes the
TODO in the diff.
Zig safety checks save us! It was setting undefined values to `0xAA` and
we caught that in a crash. We need to zero this memory.
Practically this happened when `cat`-ing a large file, then attempting
to select and copy any blank trailing space.
This logic is truly terrible and I know for certain there is an easier
way to calculate this. I also know there are some bugs here. But, the
user-facing result is not bad so let's start with this.
This cleans up a ton of state management around cursor styles,
visibility, blinking, etc. This was long in the tooth and when I was
trying to implement mode 25 I realized it was impossible with the
spaghetti mess I had. This made it really clean.
With this refactor, the Window keeps the "terminal_cursor" field the
proper state, and the render callback properly updates the gpu cells for
the cursor settings.
This also implements mode 25 (cursor visible) which makes neovim not
"flash" when vertically scrolling a vertical split. Neovim does some
cursor stuff but while doing so hides the cursor. This now respects
that.
This lets values modify themselves, which we use to make a repeatable
string implementation. We will use this initially to specify config
files to load.
This gets vttest page 1 and page 2 now FULL passing.
We now crash on page 3. This is a lingering bug in our grid code
though and we need to find it anyways so we'll keep the crash in.