terminal: convert APC

pull/9342/head
Mitchell Hashimoto 2025-10-23 21:21:39 -07:00
parent b91149f0fe
commit 6902d89d91
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 12 additions and 17 deletions

View File

@ -99,6 +99,9 @@ pub const Action = union(Key) {
kitty_keyboard_set: KittyKeyboardFlags,
kitty_keyboard_set_or: KittyKeyboardFlags,
kitty_keyboard_set_not: KittyKeyboardFlags,
apc_start,
apc_end,
apc_put: u8,
prompt_end,
end_of_input,
end_hyperlink,
@ -177,6 +180,9 @@ pub const Action = union(Key) {
"kitty_keyboard_set",
"kitty_keyboard_set_or",
"kitty_keyboard_set_not",
"apc_start",
"apc_end",
"apc_put",
"prompt_end",
"end_of_input",
"end_hyperlink",
@ -559,15 +565,9 @@ pub fn Stream(comptime Handler: type) type {
.dcs_unhook => if (@hasDecl(T, "dcsUnhook")) {
try self.handler.dcsUnhook();
} else log.warn("unimplemented DCS unhook", .{}),
.apc_start => if (@hasDecl(T, "apcStart")) {
try self.handler.apcStart();
} else log.warn("unimplemented APC start", .{}),
.apc_put => |code| if (@hasDecl(T, "apcPut")) {
try self.handler.apcPut(code);
} else log.warn("unimplemented APC put: {x}", .{code}),
.apc_end => if (@hasDecl(T, "apcEnd")) {
try self.handler.apcEnd();
} else log.warn("unimplemented APC end", .{}),
.apc_start => try self.handler.vt(.apc_start, {}),
.apc_put => |code| try self.handler.vt(.apc_put, code),
.apc_end => try self.handler.vt(.apc_end, {}),
}
}
}

View File

@ -303,6 +303,9 @@ pub const StreamHandler = struct {
.end_hyperlink => try self.endHyperlink(),
.active_status_display => self.terminal.status_display = value,
.decaln => try self.decaln(),
.apc_start => self.apc.start(),
.apc_end => try self.apcEnd(),
.apc_put => self.apc.feed(self.alloc, value),
// Unimplemented
.title_push,
@ -418,14 +421,6 @@ pub const StreamHandler = struct {
}
}
pub inline fn apcStart(self: *StreamHandler) !void {
self.apc.start();
}
pub inline fn apcPut(self: *StreamHandler, byte: u8) !void {
self.apc.feed(self.alloc, byte);
}
pub fn apcEnd(self: *StreamHandler) !void {
var cmd = self.apc.end() orelse return;
defer cmd.deinit(self.alloc);