termio: fix up rebase

This commit is contained in:
Mitchell Hashimoto
2024-07-13 15:21:50 -07:00
parent 16f5890724
commit faef40b769

View File

@ -173,19 +173,31 @@ pub const StreamHandler = struct {
} }
pub fn dcsHook(self: *StreamHandler, dcs: terminal.DCS) !void { pub fn dcsHook(self: *StreamHandler, dcs: terminal.DCS) !void {
self.dcs.hook(self.alloc, dcs); var cmd = self.dcs.hook(self.alloc, dcs) orelse return;
defer cmd.deinit();
try self.dcsCommand(&cmd);
} }
pub fn dcsPut(self: *StreamHandler, byte: u8) !void { 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 { pub fn dcsUnhook(self: *StreamHandler) !void {
var cmd = self.dcs.unhook() orelse return; var cmd = self.dcs.unhook() orelse return;
defer cmd.deinit(); defer cmd.deinit();
try self.dcsCommand(&cmd);
}
fn dcsCommand(self: *StreamHandler, cmd: *terminal.dcs.Command) !void {
// log.warn("DCS command: {}", .{cmd}); // log.warn("DCS command: {}", .{cmd});
switch (cmd) { switch (cmd.*) {
.tmux => |tmux| {
// TODO: process it
log.warn("tmux control mode event unimplemented cmd={}", .{tmux});
},
.xtgettcap => |*gettcap| { .xtgettcap => |*gettcap| {
const map = comptime terminfo.ghostty.xtgettcapMap(); const map = comptime terminfo.ghostty.xtgettcapMap();
while (gettcap.next()) |key| { while (gettcap.next()) |key| {
@ -193,6 +205,7 @@ pub const StreamHandler = struct {
self.messageWriter(.{ .write_stable = response }); self.messageWriter(.{ .write_stable = response });
} }
}, },
.decrqss => |decrqss| { .decrqss => |decrqss| {
var response: [128]u8 = undefined; var response: [128]u8 = undefined;
var stream = std.io.fixedBufferStream(&response); var stream = std.io.fixedBufferStream(&response);