From a1130095f877c10b520e6ddf86b627b2c6015eea Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 26 Aug 2022 09:27:51 -0700 Subject: [PATCH] note charsets are TODO --- TODO.md | 1 + src/terminal/sgr.zig | 10 ++++++++-- src/terminal/stream.zig | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 2a196d5a9..ce765aa44 100644 --- a/TODO.md +++ b/TODO.md @@ -38,3 +38,4 @@ Major Features: * Kitty keyboard protocol: https://sw.kovidgoyal.net/kitty/keyboard-protocol/ * Kitty graphics protocol: https://sw.kovidgoyal.net/kitty/graphics-protocol/ * Mouse events +* Charsets (i.e. line drawing, `CSI ( B` and so on) diff --git a/src/terminal/sgr.zig b/src/terminal/sgr.zig index 26d8541ee..d2e41d31e 100644 --- a/src/terminal/sgr.zig +++ b/src/terminal/sgr.zig @@ -10,7 +10,13 @@ pub const Attribute = union(enum) { unset: void, /// Unknown attribute, the raw CSI command parameters are here. - unknown: []const u16, + unknown: struct { + /// Full is the full SGR input. + full: []const u16, + + /// Partial is the remaining, where we got hung up. + partial: []const u16, + }, /// Bold the text. bold: void, @@ -149,7 +155,7 @@ pub const Parser = struct { else => {}, } - return Attribute{ .unknown = slice }; + return Attribute{ .unknown = .{ .full = self.params, .partial = slice } }; } }; diff --git a/src/terminal/stream.zig b/src/terminal/stream.zig index 33b86d314..b695b4e96 100644 --- a/src/terminal/stream.zig +++ b/src/terminal/stream.zig @@ -413,6 +413,13 @@ pub fn Stream(comptime Handler: type) type { action: Parser.Action.ESC, ) !void { switch (action.final) { + // Charsets + 'B' => { + // TODO: Charset support. Just ignore this for now because + // every application sets this and it makes our logs SO + // noisy. + }, + // DECSC - Save Cursor '7' => if (@hasDecl(T, "saveCursor")) switch (action.intermediates.len) { 0 => try self.handler.saveCursor(),