From 5168dc76453c706cebaf735ff7fcad233aa72934 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 28 Aug 2023 11:38:11 -0700 Subject: [PATCH] renderer: do not render if synchronized output is on --- src/renderer/Metal.zig | 6 ++++++ src/renderer/OpenGL.zig | 6 ++++++ src/termio/Thread.zig | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index 245ead92e..501c98fe5 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -467,6 +467,12 @@ pub fn render( state.mutex.lock(); defer state.mutex.unlock(); + // If we're in a synchronized output state, we pause all rendering. + if (state.terminal.modes.get(.synchronized_output)) { + log.debug("synchronized output started, skipping render", .{}); + return; + } + self.cursor_visible = visible: { // If the cursor is explicitly not visible in the state, // then it is not visible. diff --git a/src/renderer/OpenGL.zig b/src/renderer/OpenGL.zig index cbd529760..b5c77db78 100644 --- a/src/renderer/OpenGL.zig +++ b/src/renderer/OpenGL.zig @@ -709,6 +709,12 @@ pub fn render( state.mutex.lock(); defer state.mutex.unlock(); + // If we're in a synchronized output state, we pause all rendering. + if (state.terminal.modes.get(.synchronized_output)) { + log.debug("synchronized output started, skipping render", .{}); + return; + } + self.cursor_visible = visible: { // If the cursor is explicitly not visible in the state, // then it is not visible. diff --git a/src/termio/Thread.zig b/src/termio/Thread.zig index 6f2a4af3f..0b345ac1f 100644 --- a/src/termio/Thread.zig +++ b/src/termio/Thread.zig @@ -29,7 +29,7 @@ const Coalesce = struct { /// The number of milliseconds before we reset the synchronized output flag /// if the running program hasn't already. -const sync_reset_ms = 5000; +const sync_reset_ms = 1000; /// Allocator used for some state alloc: std.mem.Allocator,