mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-06 09:56:34 +00:00
parse more SGR attrs
This commit is contained in:
@@ -15,6 +15,15 @@ pub const Attribute = union(enum) {
|
||||
/// Bold the text.
|
||||
bold: void,
|
||||
|
||||
/// Underline the text
|
||||
underline: void,
|
||||
|
||||
/// Blink the text
|
||||
blink: void,
|
||||
|
||||
/// Invert fg/bg colors.
|
||||
inverse: void,
|
||||
|
||||
/// Set foreground color as RGB values.
|
||||
direct_color_fg: RGB,
|
||||
|
||||
@@ -68,6 +77,12 @@ pub const Parser = struct {
|
||||
|
||||
1 => return Attribute{ .bold = {} },
|
||||
|
||||
4 => return Attribute{ .underline = {} },
|
||||
|
||||
5 => return Attribute{ .blink = {} },
|
||||
|
||||
7 => return Attribute{ .inverse = {} },
|
||||
|
||||
30...37 => return Attribute{
|
||||
.@"8_fg" = @intToEnum(color.Name, slice[0] - 30),
|
||||
},
|
||||
@@ -178,6 +193,11 @@ test "sgr: bold" {
|
||||
try testing.expect(v == .bold);
|
||||
}
|
||||
|
||||
test "sgr: inverse" {
|
||||
const v = testParse(&[_]u16{7});
|
||||
try testing.expect(v == .inverse);
|
||||
}
|
||||
|
||||
test "sgr: 8 color" {
|
||||
var p: Parser = .{ .params = &[_]u16{ 31, 43, 103 } };
|
||||
|
||||
|
Reference in New Issue
Block a user