diff --git a/src/terminal/Parser.zig b/src/terminal/Parser.zig index 3e7a764f8..90aaefcd6 100644 --- a/src/terminal/Parser.zig +++ b/src/terminal/Parser.zig @@ -48,6 +48,7 @@ pub const TransitionAction = enum { csi_dispatch, put, osc_put, + apc_put, }; /// Action is the action that a caller of the parser is expected to @@ -74,6 +75,11 @@ pub const Action = union(enum) { dcs_put: u8, dcs_unhook: void, + /// APC data + apc_start: void, + apc_put: u8, + apc_end: void, + pub const CSI = struct { intermediates: []u8, params: []u16, @@ -247,6 +253,7 @@ pub fn next(self: *Parser, c: u8) [3]?Action { else null, .dcs_passthrough => Action{ .dcs_unhook = {} }, + .sos_pm_apc_string => Action{ .apc_end = {} }, else => null, }, @@ -269,6 +276,7 @@ pub fn next(self: *Parser, c: u8) [3]?Action { .final = c, }, }, + .sos_pm_apc_string => Action{ .apc_start = {} }, .utf8 => utf8: { // When entering the UTF8 state, we need to grab the // last intermediate as our first byte and reset @@ -426,9 +434,8 @@ fn doAction(self: *Parser, action: TransitionAction, c: u8) ?Action { .final = c, }, }, - .put => Action{ - .dcs_put = c, - }, + .put => Action{ .dcs_put = c }, + .apc_put => Action{ .apc_put = c }, }; } diff --git a/src/terminal/parse_table.zig b/src/terminal/parse_table.zig index a8d2ec768..094128cc7 100644 --- a/src/terminal/parse_table.zig +++ b/src/terminal/parse_table.zig @@ -125,10 +125,10 @@ fn genTable() Table { const source = State.sos_pm_apc_string; // events - single(&result, 0x19, source, source, .ignore); - range(&result, 0, 0x17, source, source, .ignore); - range(&result, 0x1C, 0x1F, source, source, .ignore); - range(&result, 0x20, 0x7F, source, source, .ignore); + single(&result, 0x19, source, source, .apc_put); + range(&result, 0, 0x17, source, source, .apc_put); + range(&result, 0x1C, 0x1F, source, source, .apc_put); + range(&result, 0x20, 0x7F, source, source, .apc_put); } // escape diff --git a/src/terminal/stream.zig b/src/terminal/stream.zig index c57fb3122..590d7ad74 100644 --- a/src/terminal/stream.zig +++ b/src/terminal/stream.zig @@ -64,8 +64,11 @@ pub fn Stream(comptime Handler: type) type { .esc_dispatch => |esc| try self.escDispatch(esc), .osc_dispatch => |cmd| try self.oscDispatch(cmd), .dcs_hook => |dcs| log.warn("unhandled DCS hook: {}", .{dcs}), - .dcs_put => |code| log.warn("unhandled DCS put: {}", .{code}), + .dcs_put => |code| log.warn("unhandled DCS put: {x}", .{code}), .dcs_unhook => log.warn("unhandled DCS unhook", .{}), + .apc_start => log.warn("unhandled APC start", .{}), + .apc_put => |code| log.warn("unhandled APC put: {x}", .{code}), + .apc_end => log.warn("unhandled APC end", .{}), } } }