diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index f19fec862..b281ea4fc 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -338,7 +338,9 @@ pub fn selectGraphicRendition(self: *Terminal, aspect: ansi.RenditionAspect) !vo .bold => self.cursor.bold = true, .default_fg => {}, // TODO .default_bg => {}, // TODO - else => log.warn("invalid or unimplemented rendition aspect: {}", .{aspect}), + else => { + //log.warn("invalid or unimplemented rendition aspect: {}", .{aspect}); + }, } } diff --git a/src/terminal/osc.zig b/src/terminal/osc.zig index 23b86b010..1cff9821e 100644 --- a/src/terminal/osc.zig +++ b/src/terminal/osc.zig @@ -48,6 +48,10 @@ pub const Command = union(enum) { exit_code: ?u8 = null, // TODO: err option }, + + /// Reset the color for the cursor. This reverts changes made with + /// change/read cursor color. + reset_cursor_color: void, }; pub const Parser = struct { @@ -91,6 +95,7 @@ pub const Parser = struct { // but the state space is small enough that we just build it up this way. @"0", @"1", + @"11", @"13", @"133", @@ -148,10 +153,20 @@ pub const Parser = struct { }, .@"1" => switch (c) { + '1' => self.state = .@"11", '3' => self.state = .@"13", else => self.state = .invalid, }, + .@"11" => switch (c) { + '2' => { + self.complete = true; + self.command = .{ .reset_cursor_color = {} }; + self.state = .invalid; + }, + else => self.state = .invalid, + }, + .@"13" => switch (c) { '3' => self.state = .@"133", else => self.state = .invalid, @@ -357,3 +372,15 @@ test "OSC: prompt_end" { const cmd = p.end().?; try testing.expect(cmd == .prompt_end); } + +test "OSC: reset_cursor_color" { + const testing = std.testing; + + var p: Parser = .{}; + + const input = "112"; + for (input) |ch| p.next(ch); + + const cmd = p.end().?; + try testing.expect(cmd == .reset_cursor_color); +}