aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/renderer/generic.zig
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-16 23:28:05 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-16 23:29:28 +0300
commit4a3302d19a2baa3a33e910e0088c24e780905b90 (patch)
treedcaf76fae1c82102d933c9225b17ca7ac5d3a847 /vendor/libghostty-vt/src/renderer/generic.zig
parent550e9f8cc085f428429f5cf2da0bb2dba897e8b8 (diff)
chore: update vendored libghostty-vt
refs #276
Diffstat (limited to 'vendor/libghostty-vt/src/renderer/generic.zig')
-rw-r--r--vendor/libghostty-vt/src/renderer/generic.zig22
1 files changed, 18 insertions, 4 deletions
diff --git a/vendor/libghostty-vt/src/renderer/generic.zig b/vendor/libghostty-vt/src/renderer/generic.zig
index 0f4a294b..14b79036 100644
--- a/vendor/libghostty-vt/src/renderer/generic.zig
+++ b/vendor/libghostty-vt/src/renderer/generic.zig
@@ -1170,8 +1170,10 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
// std.log.err("[updateFrame critical time] start={}\tduration={} us", .{ start_micro, end.since(start) / std.time.ns_per_us });
// }
- state.mutex.lock();
- defer state.mutex.unlock();
+ // Lock while signaling demand so the IO parse thread
+ // can't starve us. See renderer.State.lockDemand.
+ state.lockDemand();
+ defer state.unlockDemand();
// If we're in a synchronized output state, we pause all rendering.
if (state.terminal.modes.get(.synchronized_output)) {
@@ -1199,8 +1201,15 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
state.terminal.scrollViewport(.bottom);
}
- // Update our terminal state
- try self.terminal_state.update(self.alloc, state.terminal);
+ // Begin the update of our terminal state. Work that
+ // doesn't require terminal access (e.g. style
+ // denormalization) is deferred to the endUpdate call
+ // outside of this critical section, keeping our lock
+ // hold time as short as possible.
+ try self.terminal_state.beginUpdate(
+ self.alloc,
+ state.terminal,
+ );
// If our terminal state is dirty at all we need to redo
// the viewport search.
@@ -1279,6 +1288,11 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
};
};
+ // Outside the critical area, complete the update we began
+ // within it. This must be done before anything reads the
+ // render state (e.g. rebuildCells).
+ self.terminal_state.endUpdate();
+
// Outside the critical area we can update our links to contain
// our regex results.
self.config.links.renderCellMap(