OSC: clean up color_operation handling

pull/7429/head
Jeffrey C. Ollie 2025-05-24 08:32:10 -05:00
parent f2dfd9f677
commit e0ddc7a2fa
No known key found for this signature in database
GPG Key ID: 6F86035A6D97044E
1 changed files with 5 additions and 0 deletions

View File

@ -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);