diff --git a/src/terminal/Parser.zig b/src/terminal/Parser.zig index 500306201..154dfee22 100644 --- a/src/terminal/Parser.zig +++ b/src/terminal/Parser.zig @@ -218,6 +218,10 @@ pub fn init() Parser { return .{}; } +pub fn deinit(self: *Parser) void { + self.osc_parser.deinit(); +} + /// Next consumes the next character c and returns the actions to execute. /// Up to 3 actions may need to be executed -- in order -- representing /// the state exit, transition, and entry actions. diff --git a/src/terminal/stream.zig b/src/terminal/stream.zig index d3bc372a1..d3ab59e37 100644 --- a/src/terminal/stream.zig +++ b/src/terminal/stream.zig @@ -38,6 +38,10 @@ pub fn Stream(comptime Handler: type) type { handler: Handler, parser: Parser = .{}, + pub fn deinit(self: *Self) void { + self.parser.deinit(); + } + /// Process a string of characters. pub fn nextSlice(self: *Self, c: []const u8) !void { const tracy = trace(@src()); diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index c25b70031..69bbb65eb 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -229,6 +229,14 @@ pub fn threadEnter(self: *Exec, thread: *termio.Thread) !ThreadData { .default_background_color = self.default_background_color, .osc_color_report_format = self.osc_color_report_format, }, + + .parser = .{ + .osc_parser = .{ + // Populate the OSC parser allocator (optional) because + // we want to support large OSC payloads such as OSC 52. + .alloc = self.alloc, + }, + }, }, }; errdefer ev_data_ptr.deinit(self.alloc); @@ -565,6 +573,7 @@ const EventData = struct { // Clear any StreamHandler state self.terminal_stream.handler.deinit(); + self.terminal_stream.deinit(); } /// This queues a render operation with the renderer thread. The render