- move wuffs code from src/ to pkg/
- eliminate stray debug logs
- make logs a warning instead of an error
- remove initialization of some structs to zero
Improve the performance of Kitty graphics by switching to the WUFFS
library for decoding PNG images and for "swizzling" G, GA, and RGB data
to RGBA formats needed by the renderers.
WUFFS claims 2-3x performance benefits over other implementations, as
well as memory-safe operations.
Although not thorougly benchmarked, performance is on par with Kitty's
graphics decoding.
https://github.com/google/wuffs
If the transmission medium is a local-only medium, ignore the "m"
key. The Kitty graphics protocol specification does not explicitly
call out this behavior (although the "m" key is only mentioned in
connection with remote clients) but that's how it's implemented in
Kitty and at least one client (mpv) relies on this behavior when
using the shared memory transmission medium.
https://sw.kovidgoyal.net/kitty/graphics-protocol/#the-transmission-mediumccc3bee9af/kitty/graphics.c (L547-L592)
It's possible for `self.grow` to be called within the body of the
function, and `self.grow` uses `self.cols` to create a new page if
there's no more room in the current one.
Handle `clonePartialRowFrom` errors in `insertLines` and `deleteLines`
by adjusting page capacity. To do this, I've rewritten both functions
with a new way of iterating rows by moving a tracked pin up/down.
Benchmarks seem to indicate that this has no effect on performance.
If we call `moveLastRowToNewPage` at any point because we failed to copy
some managed memory, it tries to copy managed memory that hasn't been
cloned yet when moving our progress to a new page.
Avoid this by setting our content tag, hyperlink flag, and style id to
indicate no managed memory is present on the cell.
Before, cells that were explicitly set to match the default bg color
were treated as if they did NOT have the default and extending would
occur. We now check the exact RGB of each cell.
When a screen is resized, the pages are generally reallocated. This
causes the cursor hyperlink state to be lost and ultimately the
hyperlink ref count is off by one.
The unit test in this commit showcases the issue very clearly. And you
can see we do this logic already for styles. We never copied it over for
hyperlinks.
- Cap the total number of requests at twice the maximum number of
keys (currently 263, so 526 requests). Basically you can set and then
query every key in one message. This is an absurdly high number
but should prevent serious DOS attacks.
- Clarify meaning of new hex color codes.
- Better handle sending messages to the renderer in a way that should
prevent deadlocks.
- Handle 0-255 palette color requests by creatively using non-exhautive
enums.
- Fix an error in the query reply.
Ghostty previously incorrectly only created scrollback if the top/bot
margins were the full height of the viewport. The actual xterm behavior
is to create scrollback as long as the top margin is the top row and the
cursor is on the bottom margin (wherever that may be).
Kitty 0.36.0 added support for a new OSC escape sequence for
quering, setting, and resetting the terminal colors. Details
can be found [here](https://sw.kovidgoyal.net/kitty/color-stack/#setting-and-querying-colors).
This fully parses the OSC 21 escape sequences, but only supports
actually querying and changing the foreground color, the background
color, and the cursor color because that's what Ghostty currently
supports. Adding support for the other settings that Kitty supports
changing ranges from easy (cursor text) to difficult (visual bell,
second transparent background color).