mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 08:16:13 +03:00
sgr: parse italic (render not implemented)
This commit is contained in:
@ -161,6 +161,7 @@ pub const Cell = struct {
|
||||
has_fg: bool = false,
|
||||
|
||||
bold: bool = false,
|
||||
italic: bool = false,
|
||||
faint: bool = false,
|
||||
underline: bool = false,
|
||||
inverse: bool = false,
|
||||
|
@ -351,6 +351,10 @@ pub fn setAttribute(self: *Terminal, attr: sgr.Attribute) !void {
|
||||
self.screen.cursor.pen.attrs.bold = true;
|
||||
},
|
||||
|
||||
.italic => {
|
||||
self.screen.cursor.pen.attrs.italic = true;
|
||||
},
|
||||
|
||||
.faint => {
|
||||
self.screen.cursor.pen.attrs.faint = true;
|
||||
},
|
||||
|
@ -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});
|
||||
|
Reference in New Issue
Block a user