mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +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,
|
has_fg: bool = false,
|
||||||
|
|
||||||
bold: bool = false,
|
bold: bool = false,
|
||||||
|
italic: bool = false,
|
||||||
faint: bool = false,
|
faint: bool = false,
|
||||||
underline: bool = false,
|
underline: bool = false,
|
||||||
inverse: 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;
|
self.screen.cursor.pen.attrs.bold = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.italic => {
|
||||||
|
self.screen.cursor.pen.attrs.italic = true;
|
||||||
|
},
|
||||||
|
|
||||||
.faint => {
|
.faint => {
|
||||||
self.screen.cursor.pen.attrs.faint = true;
|
self.screen.cursor.pen.attrs.faint = true;
|
||||||
},
|
},
|
||||||
|
@ -21,6 +21,9 @@ pub const Attribute = union(enum) {
|
|||||||
/// Bold the text.
|
/// Bold the text.
|
||||||
bold: void,
|
bold: void,
|
||||||
|
|
||||||
|
/// Italic text.
|
||||||
|
italic: void,
|
||||||
|
|
||||||
/// Faint/dim text.
|
/// Faint/dim text.
|
||||||
faint: void,
|
faint: void,
|
||||||
|
|
||||||
@ -97,6 +100,8 @@ pub const Parser = struct {
|
|||||||
|
|
||||||
2 => return Attribute{ .faint = {} },
|
2 => return Attribute{ .faint = {} },
|
||||||
|
|
||||||
|
3 => return Attribute{ .italic = {} },
|
||||||
|
|
||||||
4 => return Attribute{ .underline = {} },
|
4 => return Attribute{ .underline = {} },
|
||||||
|
|
||||||
5 => return Attribute{ .blink = {} },
|
5 => return Attribute{ .blink = {} },
|
||||||
@ -224,6 +229,11 @@ test "sgr: bold" {
|
|||||||
try testing.expect(v == .bold);
|
try testing.expect(v == .bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "sgr: italic" {
|
||||||
|
const v = testParse(&[_]u16{3});
|
||||||
|
try testing.expect(v == .italic);
|
||||||
|
}
|
||||||
|
|
||||||
test "sgr: inverse" {
|
test "sgr: inverse" {
|
||||||
{
|
{
|
||||||
const v = testParse(&[_]u16{7});
|
const v = testParse(&[_]u16{7});
|
||||||
|
Reference in New Issue
Block a user