terminal: SGR parse invisible (attr 8, 28)

This commit is contained in:
Mitchell Hashimoto
2023-06-25 09:19:43 -07:00
parent f9978e8524
commit aafff194f9

View File

@ -1,4 +1,4 @@
//! SGR (Select Graphic Rendition) attribute parsing and types.
//! SGR (Select Graphic Rendition) attrinvbute parsing and types.
const std = @import("std");
const testing = std.testing;
@ -44,6 +44,10 @@ pub const Attribute = union(enum) {
inverse: void,
reset_inverse: void,
/// Invisible
invisible: void,
reset_invisible: void,
/// Strikethrough the text.
strikethrough: void,
reset_strikethrough: void,
@ -163,6 +167,8 @@ pub const Parser = struct {
7 => return Attribute{ .inverse = {} },
8 => return Attribute{ .invisible = {} },
9 => return Attribute{ .strikethrough = {} },
22 => return Attribute{ .reset_bold = {} },
@ -175,6 +181,8 @@ pub const Parser = struct {
27 => return Attribute{ .reset_inverse = {} },
28 => return Attribute{ .reset_invisible = {} },
29 => return Attribute{ .reset_strikethrough = {} },
30...37 => return Attribute{
@ -499,3 +507,9 @@ test "sgr: reset underline color" {
var p: Parser = .{ .params = &[_]u16{59} };
try testing.expect(p.next().? == .reset_underline_color);
}
test "sgr: invisible" {
var p: Parser = .{ .params = &[_]u16{ 8, 28 } };
try testing.expect(p.next().? == .invisible);
try testing.expect(p.next().? == .reset_invisible);
}