mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
terminal: track underline color on cell
This commit is contained in:
@ -182,6 +182,12 @@ pub const Cell = struct {
|
|||||||
fg: color.RGB = .{},
|
fg: color.RGB = .{},
|
||||||
bg: color.RGB = .{},
|
bg: color.RGB = .{},
|
||||||
|
|
||||||
|
/// Underline color.
|
||||||
|
/// NOTE(mitchellh): This is very rarely set so ideally we wouldn't waste
|
||||||
|
/// cell space for this. For now its on this struct because it is convenient
|
||||||
|
/// but we should consider a lookaside table for this.
|
||||||
|
underline_fg: color.RGB = .{},
|
||||||
|
|
||||||
/// On/off attributes that can be set
|
/// On/off attributes that can be set
|
||||||
attrs: packed struct {
|
attrs: packed struct {
|
||||||
has_bg: bool = false,
|
has_bg: bool = false,
|
||||||
@ -194,6 +200,7 @@ pub const Cell = struct {
|
|||||||
inverse: bool = false,
|
inverse: bool = false,
|
||||||
strikethrough: bool = false,
|
strikethrough: bool = false,
|
||||||
underline: sgr.Attribute.Underline = .none,
|
underline: sgr.Attribute.Underline = .none,
|
||||||
|
underline_color: bool = false,
|
||||||
|
|
||||||
/// True if this is a wide character. This char takes up
|
/// True if this is a wide character. This char takes up
|
||||||
/// two cells. The following cell ALWAYS is a space.
|
/// two cells. The following cell ALWAYS is a space.
|
||||||
@ -265,7 +272,7 @@ pub const Cell = struct {
|
|||||||
|
|
||||||
test {
|
test {
|
||||||
//log.warn("CELL={} bits={} {}", .{ @sizeOf(Cell), @bitSizeOf(Cell), @alignOf(Cell) });
|
//log.warn("CELL={} bits={} {}", .{ @sizeOf(Cell), @bitSizeOf(Cell), @alignOf(Cell) });
|
||||||
try std.testing.expectEqual(12, @sizeOf(Cell));
|
try std.testing.expectEqual(16, @sizeOf(Cell));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -461,8 +461,18 @@ pub fn setAttribute(self: *Terminal, attr: sgr.Attribute) !void {
|
|||||||
self.screen.cursor.pen.attrs.underline = .none;
|
self.screen.cursor.pen.attrs.underline = .none;
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO
|
.underline_color => |rgb| {
|
||||||
.underline_color, .reset_underline_color => {},
|
self.screen.cursor.pen.attrs.underline_color = true;
|
||||||
|
self.screen.cursor.pen.underline_fg = .{
|
||||||
|
.r = rgb.r,
|
||||||
|
.g = rgb.g,
|
||||||
|
.b = rgb.b,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
.reset_underline_color => {
|
||||||
|
self.screen.cursor.pen.attrs.underline_color = false;
|
||||||
|
},
|
||||||
|
|
||||||
.blink => {
|
.blink => {
|
||||||
log.warn("blink requested, but not implemented", .{});
|
log.warn("blink requested, but not implemented", .{});
|
||||||
|
Reference in New Issue
Block a user