input: use std.Io.Writer for key encoder, new API, expose via libghostty

This modernizes `KeyEncoder` to a new `std.Io.Writer`-based API.
Additionally, instead of a single struct, it is now an `encode` function
that takes a series of more focused options. This is more idiomatic Zig
while also making it easier to expose via libghostty-vt.

libghostty-vt also gains access to key encoding APIs.
This commit is contained in:
Mitchell Hashimoto
2025-10-04 15:04:52 -07:00
parent 503a25653f
commit 44496df899
11 changed files with 880 additions and 891 deletions

View File

@@ -293,6 +293,11 @@ fn pcStyle(comptime fmt: []const u8) []Entry {
test "keys" {
const testing = std.testing;
switch (@import("terminal_options").artifact) {
.ghostty => {},
// Don't want to bring in termio into libghostty-vt
.lib => return error.SkipZigTest,
}
// Force resolution for comptime evaluation.
_ = keys;