aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/termio/Thread.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/termio/Thread.zig
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/termio/Thread.zig')
-rw-r--r--vendor/libghostty-vt/src/termio/Thread.zig24
1 files changed, 19 insertions, 5 deletions
diff --git a/vendor/libghostty-vt/src/termio/Thread.zig b/vendor/libghostty-vt/src/termio/Thread.zig
index ce4c1f4a..de268350 100644
--- a/vendor/libghostty-vt/src/termio/Thread.zig
+++ b/vendor/libghostty-vt/src/termio/Thread.zig
@@ -14,7 +14,8 @@ pub const Thread = @This();
const std = @import("std");
const ArenaAllocator = std.heap.ArenaAllocator;
const builtin = @import("builtin");
-const xev = @import("../global.zig").xev;
+const global = @import("../global.zig");
+const xev = global.xev;
const crash = @import("../crash/main.zig");
const internal_os = @import("../os/main.zig");
const termio = @import("../termio.zig");
@@ -147,8 +148,8 @@ pub fn threadMain(self: *Thread, io: *termio.Termio) void {
// the error to the surface thread and let the apprt deal with it
// in some way but this works for now. Without this, the user would
// just see a blank terminal window.
- io.renderer_state.mutex.lock();
- defer io.renderer_state.mutex.unlock();
+ io.renderer_state.mutex.lockUncancelable(global.io());
+ defer io.renderer_state.mutex.unlock(global.io());
const t = io.renderer_state.terminal;
// Hide the cursor
@@ -297,7 +298,7 @@ fn drainMailbox(
// If we're draining, we just drain the mailbox and return.
if (self.flags.drain) {
- while (mailbox.pop()) |_| {}
+ while (mailbox.pop(global.io())) |msg| msg.deinit();
return;
}
@@ -305,13 +306,18 @@ fn drainMailbox(
// expectation is that all our message handlers will be non-blocking
// ENOUGH to not mess up throughput on producers.
var redraw: bool = false;
- while (mailbox.pop()) |message| {
+ while (mailbox.pop(global.io())) |message| {
// If we have a message we always redraw
redraw = true;
log.debug("mailbox message={s}", .{@tagName(message)});
switch (message) {
.color_scheme_report => |v| try io.colorSchemeReport(data, v.force),
+ .visibility_report => |v| try io.visibilityReport(
+ data,
+ v.visible,
+ v.force,
+ ),
.crash => @panic("crash request, crashing intentionally"),
.change_config => |config| {
defer config.alloc.destroy(config.ptr);
@@ -330,6 +336,14 @@ fn drainMailbox(
}
},
.jump_to_prompt => |v| try io.jumpToPrompt(v),
+ .kitty_clipboard_grant_read => |v| {
+ defer v.alloc.free(v.pw);
+ try io.kittyClipboardGrant(v.pw, .read);
+ },
+ .kitty_clipboard_grant_write => |v| {
+ defer v.alloc.free(v.pw);
+ try io.kittyClipboardGrant(v.pw, .write);
+ },
.start_synchronized_output => self.startSynchronizedOutput(cb),
.linefeed_mode => |v| self.flags.linefeed_mode = v,
.focused => |v| try io.focusGained(data, v),