From e0ddc7a2fa66b5e990fc1bfa6ddc0e3ef930bb40 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sat, 24 May 2025 08:32:10 -0500 Subject: [PATCH] OSC: clean up color_operation handling --- src/termio/stream_handler.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/termio/stream_handler.zig b/src/termio/stream_handler.zig index 5977f6564..4bb0f9c9d 100644 --- a/src/termio/stream_handler.zig +++ b/src/termio/stream_handler.zig @@ -1201,6 +1201,9 @@ pub const StreamHandler = struct { operations: *const terminal.osc.Command.ColorOperationList, terminator: terminal.osc.Terminator, ) !void { + // return early if there is nothing to do + if (operations.count() == 0) return; + var buffer: [1024]u8 = undefined; var fba: std.heap.FixedBufferAllocator = .init(&buffer); const alloc = fba.allocator(); @@ -1366,6 +1369,8 @@ pub const StreamHandler = struct { } } if (report) { + // If any of the operations were reports, finialize the report + // string and send it to the terminal. try writer.writeAll(terminator.string()); const msg = try termio.Message.writeReq(self.alloc, response.items); self.messageWriter(msg);