termio/exec: remove a bunch of state that is duplicated on StreamHandler

A lot of the state that we put on Exec is just there to copy to
StreamHandler, but we already have it in DerivedConfig. I think this
whole copy copy copy is just legacy cruft since termio.Exec is one of
the older parts of the source code.

This rearchitects the Exec struct to act more like Surface and Renderer
where it stores its derived config. This lets us avoid a few extra
allocations and removes a LOT of struct member noise from termio.Exec.

For pointer lifetimes, the memory allocated is now owned by
DerivedConfig. When changeConfig is called, its the only time BOTH are
still alive, so we can safely swap pointers and deinit without having to
duplicate across threads. This is the same as renderer/surface.
This commit is contained in:
Mitchell Hashimoto
2024-01-10 09:15:37 -08:00
parent 6112d56eed
commit 4b6c2f86a7
2 changed files with 88 additions and 134 deletions

View File

@@ -898,7 +898,7 @@ term: []const u8 = "xterm-ghostty",
/// String to send when we receive ENQ (0x05) from the command that we are
/// running. Defaults to "" if not set.
@"enquiry-response": ?[]const u8 = null,
@"enquiry-response": []const u8 = "",
/// This is set by the CLI parser for deinit.
_arena: ?ArenaAllocator = null,