mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-21 11:16:08 +03:00
termio: configure OSC parser with an allocator
This commit is contained in:
@ -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.
|
||||
|
@ -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());
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user