diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-10 21:51:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-10 21:51:57 +0300 |
| commit | 425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch) | |
| tree | e52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/termio/message.zig | |
| parent | 90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff) | |
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/termio/message.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/termio/message.zig | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/vendor/libghostty-vt/src/termio/message.zig b/vendor/libghostty-vt/src/termio/message.zig index 4ee7f245..24168740 100644 --- a/vendor/libghostty-vt/src/termio/message.zig +++ b/vendor/libghostty-vt/src/termio/message.zig @@ -8,20 +8,29 @@ const MessageData = @import("../datastruct/main.zig").MessageData; /// The messages that can be sent to an IO thread. /// /// This is not a tiny structure (~40 bytes at the time of writing this comment), -/// but the messages are IO thread sends are also very few. At the current size -/// we can queue 26,000 messages before consuming a MB of RAM. +/// but the number of messages we send to the IO thread is also very small. +/// At the current size we can queue 26,000 messages before consuming a MB of RAM. pub const Message = union(enum) { /// Represents a write request. Magic number comes from the largest /// other union value. It can be upped if we add a larger union member /// in the future. pub const WriteReq = MessageData(u8, 38); - /// Request a color scheme report is sent to the pty. + /// Request a color scheme report is sent to the PTY. color_scheme_report: struct { /// Force write the current color scheme force: bool, }, + /// Request a visibility report is sent to the PTY. + visibility_report: struct { + /// The visibility state to report. + visible: bool, + + /// Send the report even when mode 2033 is disabled. + force: bool, + }, + /// Purposely crash the renderer. This is used for testing and debugging. /// See the "crash" binding action. crash: void, @@ -39,7 +48,7 @@ pub const Message = union(enum) { /// Resize the window. resize: renderer.Size, - /// Request a size report is sent to the pty ([in-band + /// Request a size report is sent to the PTY ([in-band /// size report, mode 2048](https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83) and /// [XTWINOPS](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps;Ps;Ps-t.1EB0)). size_report: SizeReport, @@ -73,6 +82,12 @@ pub const Message = union(enum) { /// The surface gained or lost focus. focused: bool, + /// Record a Kitty clipboard protocol session grant for a password + /// so future requests carrying it skip the permission prompt, for + /// reads and writes respectively. + kitty_clipboard_grant_read: KittyClipboardGrant, + kitty_clipboard_grant_write: KittyClipboardGrant, + /// Write where the data fits in the union. write_small: WriteReq.Small, @@ -82,6 +97,13 @@ pub const Message = union(enum) { /// Write where the data is allocated and must be freed. write_alloc: WriteReq.Alloc, + /// The payload of the kitty_clipboard_grant_* messages. The + /// password is allocated and must be freed. + pub const KittyClipboardGrant = struct { + alloc: Allocator, + pw: []const u8, + }; + /// Return a write request for the given data. This will use /// write_small if it fits or write_alloc otherwise. This should NOT /// be used for stable pointers which can be manually set to write_stable. @@ -93,6 +115,22 @@ pub const Message = union(enum) { }; } + /// Free resources owned by a message that will not be processed. + /// The message is invalid after this call. + pub fn deinit(self: *const Message) void { + switch (self.*) { + .change_config => |v| { + v.ptr.deinit(); + v.alloc.destroy(v.ptr); + }, + .write_alloc => |v| v.alloc.free(v.data), + .kitty_clipboard_grant_read, + .kitty_clipboard_grant_write, + => |v| v.alloc.free(v.pw), + else => {}, + } + } + /// The types of size reports that we support. pub const SizeReport = terminal.size_report.Style; }; |
