diff --git a/examples/text_input.zig b/examples/text_input.zig index 3fe7c9b..aa6a825 100644 --- a/examples/text_input.zig +++ b/examples/text_input.zig @@ -61,8 +61,6 @@ pub fn main() !void { .winsize => |ws| { try vx.resize(alloc, ws); }, - .cap_rgb => continue, - .cap_kitty_keyboard => try vx.enableKittyKeyboard(.{}), else => {}, } @@ -98,7 +96,5 @@ const Event = union(enum) { key_press: vaxis.Key, winsize: vaxis.Winsize, focus_in, - cap_rgb, - cap_kitty_keyboard, foo: u8, }; diff --git a/src/Parser.zig b/src/Parser.zig index a6a3751..7a5720a 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -357,6 +357,17 @@ pub fn parse(self: *Parser, input: []const u8) !Result { log.warn("unhandled csi: CSI {s}", .{input[start + 1 .. i + 1]}); return .{ .event = null, .n = i + 1 }; }, + 'c' => { // DA1 response + const priv = seq.private_indicator orelse { + log.warn("unhandled csi: CSI {s}", .{input[start + 1 .. i + 1]}); + return .{ .event = null, .n = i + 1 }; + }; + if (priv != '?') { + log.warn("unhandled csi: CSI {s}", .{input[start + 1 .. i + 1]}); + return .{ .event = null, .n = i + 1 }; + } + return .{ .event = .cap_da1, .n = i + 1 }; + }, else => { log.warn("unhandled csi: CSI {s}", .{input[start + 1 .. i + 1]}); return .{ diff --git a/src/Tty.zig b/src/Tty.zig index 0e2baa6..44fd86f 100644 --- a/src/Tty.zig +++ b/src/Tty.zig @@ -178,19 +178,16 @@ pub fn run( } }, .cap_kitty_keyboard => { - if (@hasField(EventType, "cap_kitty_keyboard")) { - vx.postEvent(.cap_kitty_keyboard); - } + vx.caps.kitty_keyboard = true; }, .cap_rgb => { - if (@hasField(EventType, "cap_rgb")) { - vx.postEvent(.cap_rgb); - } + vx.caps.rgb = true; }, .cap_unicode => { - if (@hasField(EventType, "cap_unicode")) { - vx.postEvent(.cap_unicode); - } + vx.caps.unicode = true; + }, + .cap_da1 => { + std.Thread.Futex.wake(&vx.query_futex, 10); }, } } diff --git a/src/ctlseqs.zig b/src/ctlseqs.zig index 05d0f81..faf2b7d 100644 --- a/src/ctlseqs.zig +++ b/src/ctlseqs.zig @@ -14,6 +14,9 @@ pub const sixel_geometry_query = "\x1b[?2;1;0S"; pub const sync_set = "\x1b[?2026h"; pub const sync_reset = "\x1b[?2026l"; +pub const unicode_set = "\x1b[?2027h"; +pub const unicode_reset = "\x1b[?2027l"; + // Key encoding pub const csi_u_push = "\x1b[>{d}u"; pub const csi_u_pop = "\x1b[