sgr: parse italic (render not implemented)

This commit is contained in:
Mitchell Hashimoto
2022-11-07 14:04:40 -08:00
parent 73c4395fc2
commit c1a9184ebd
3 changed files with 15 additions and 0 deletions

View File

@@ -21,6 +21,9 @@ pub const Attribute = union(enum) {
/// Bold the text.
bold: void,
/// Italic text.
italic: void,
/// Faint/dim text.
faint: void,
@@ -97,6 +100,8 @@ pub const Parser = struct {
2 => return Attribute{ .faint = {} },
3 => return Attribute{ .italic = {} },
4 => return Attribute{ .underline = {} },
5 => return Attribute{ .blink = {} },
@@ -224,6 +229,11 @@ test "sgr: bold" {
try testing.expect(v == .bold);
}
test "sgr: italic" {
const v = testParse(&[_]u16{3});
try testing.expect(v == .italic);
}
test "sgr: inverse" {
{
const v = testParse(&[_]u16{7});