Instead of sending formfeed (0x0C), clear_screen actually does a
terminal emulator level clear instead. This MOSTLY matches the behavior
of iTerm and Terminal.app, with some differences:
1. I do not clear _below_ the cursor. I feel like the use case for
this feature is primarily to clear above the cursor. Happy to be
wrong here but I want it proven to me!
2. I do not clear in alternate screen mode. Clearing alt screens
breaks rendering in Vim, less, etc. and it feels like the wrong
behavior.
Font metrics realistically should be integral. Cell widths, cell
heights, etc. do not make sense to be floats, since our grid is
integral. There is no such thing as a "half cell" (or any point).
The reason we historically had these all as f32 is simplicity mixed
with history. OpenGL APIs and shaders all use f32 for their values, we
originally only supported OpenGL, and all the font rendering used to be
directly in the renderer code (like... a year+ ago).
When we refactored the font metrics calculation to its own system and
also added additional renderers like Metal (which use f64, not f32), we
never updated anything. We just kept metrics as f32 and casted
everywhere.
With CoreText and #177 this finally reared its ugly head. By forgetting
a simple rounding on cell metric calculation, our integral renderers
(sprite fonts) were off by 1 pixel compared to the GPU renderers.
Insidious.
Let's represent font metrics with the types that actually make sense: a
cell width/height, etc. is _integral_. When we get to the GPU, we now
cast to floats. We also cast to floats whenever we're doing more precise
math (i.e. mouse offset calculation). In this case, we're only
converting to floats from a integral type which is going to be much
safer and less prone to uncertain rounding than converting to an int
from a float type.
Fixes#177
This is a follow-up to #172 and adds fullscreen handling to the GTK
apprt.
Works reliably for the current window and mimics exactly what happens
when F11 is pressed, which seems to be the standard keybinding for GTK
apps to toggle fullscreen.
This just popped into my head. Took me a while to figure out the syntax
a few weeks back, so why not document it here? I don't think it'll
change.
I can change the colors though. What I have here is my gruvbox theme.
Maybe we should use the default colors?
This fixes or at least is the first step towards #171:
- it adds `cmd/super + return` as the default keybinding to toggle
fullscreen for currently focused window.
- it adds a keybinding handler to the embedded apprt and then changes
the macOS app to handle the keybinding by toggling currently focused
window.