SGR 39/49 (reset fg/bg, respectively)

This commit is contained in:
Mitchell Hashimoto
2022-08-26 09:56:17 -07:00
parent a1130095f8
commit 4ffd5cd994
2 changed files with 12 additions and 0 deletions

View File

@ -324,6 +324,10 @@ pub fn setAttribute(self: *Terminal, attr: sgr.Attribute) !void {
.@"8_bg" => |n| self.screen.cursor.pen.bg = color.default[@enumToInt(n)],
.reset_fg => self.screen.cursor.pen.fg = null,
.reset_bg => self.screen.cursor.pen.bg = null,
.@"8_bright_fg" => |n| self.screen.cursor.pen.fg = color.default[@enumToInt(n)],
.@"8_bright_bg" => |n| self.screen.cursor.pen.bg = color.default[@enumToInt(n)],

View File

@ -41,6 +41,10 @@ pub const Attribute = union(enum) {
@"8_bg": color.Name,
@"8_fg": color.Name,
/// Reset the fg/bg to their default values.
reset_fg: void,
reset_bg: void,
/// Set the background/foreground as a named bright color attribute.
@"8_bright_bg": color.Name,
@"8_bright_fg": color.Name,
@ -118,6 +122,8 @@ pub const Parser = struct {
};
},
39 => return Attribute{ .reset_fg = {} },
40...47 => return Attribute{
.@"8_bg" = @intToEnum(color.Name, slice[0] - 40),
},
@ -144,6 +150,8 @@ pub const Parser = struct {
};
},
49 => return Attribute{ .reset_bg = {} },
90...97 => return Attribute{
.@"8_bright_fg" = @intToEnum(color.Name, slice[0] - 90),
},