terminal: dcs put can return a command

This commit is contained in:
Mitchell Hashimoto
2024-07-11 18:42:22 -07:00
parent 38d33a761b
commit 01e1538ad3
2 changed files with 24 additions and 16 deletions

View File

@@ -1864,15 +1864,20 @@ const StreamHandler = struct {
}
pub fn dcsPut(self: *StreamHandler, byte: u8) !void {
self.dcs.put(byte);
var cmd = self.dcs.put(byte) orelse return;
defer cmd.deinit();
try self.dcsCommand(&cmd);
}
pub fn dcsUnhook(self: *StreamHandler) !void {
var cmd = self.dcs.unhook() orelse return;
defer cmd.deinit();
try self.dcsCommand(&cmd);
}
fn dcsCommand(self: *StreamHandler, cmd: *terminal.dcs.Command) !void {
// log.warn("DCS command: {}", .{cmd});
switch (cmd) {
switch (cmd.*) {
.xtgettcap => |*gettcap| {
const map = comptime terminfo.ghostty.xtgettcapMap();
while (gettcap.next()) |key| {