This makes things look a bit better, but trades pixelation for blurry
(still TODO). This also fixes an issue on Retina where if you resize
it'd make the viewport 1/4 of the size. The issue here is that OpenGL
uses pixels and glfw uses screen coordinates for everything. We adapt
the screen coords to pixels properly here.
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.