mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-17 21:12:39 +00:00
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:
@@ -72,10 +72,22 @@ pub const input = struct {
|
||||
// the input package because the full package brings in too many
|
||||
// other dependencies.
|
||||
const paste = @import("input/paste.zig");
|
||||
const key = @import("input/key.zig");
|
||||
const key_encode = @import("input/key_encode.zig");
|
||||
|
||||
// Paste-related APIs
|
||||
pub const PasteError = paste.Error;
|
||||
pub const PasteOptions = paste.Options;
|
||||
pub const isSafePaste = paste.isSafe;
|
||||
pub const encodePaste = paste.encode;
|
||||
|
||||
// Key encoding
|
||||
pub const Key = key.Key;
|
||||
pub const KeyAction = key.Action;
|
||||
pub const KeyEvent = key.KeyEvent;
|
||||
pub const KeyMods = key.Mods;
|
||||
pub const KeyEncodeOptions = key_encode.Options;
|
||||
pub const encodeKey = key_encode.encode;
|
||||
};
|
||||
|
||||
comptime {
|
||||
|
||||
Reference in New Issue
Block a user