mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
reset inverse attribute
This commit is contained in:
@ -263,6 +263,10 @@ pub fn setAttribute(self: *Terminal, attr: sgr.Attribute) !void {
|
|||||||
self.screen.cursor.pen.attrs.inverse = 1;
|
self.screen.cursor.pen.attrs.inverse = 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.reset_inverse => {
|
||||||
|
self.screen.cursor.pen.attrs.inverse = 0;
|
||||||
|
},
|
||||||
|
|
||||||
.direct_color_fg => |rgb| {
|
.direct_color_fg => |rgb| {
|
||||||
self.screen.cursor.pen.fg = .{
|
self.screen.cursor.pen.fg = .{
|
||||||
.r = rgb.r,
|
.r = rgb.r,
|
||||||
|
@ -23,6 +23,7 @@ pub const Attribute = union(enum) {
|
|||||||
|
|
||||||
/// Invert fg/bg colors.
|
/// Invert fg/bg colors.
|
||||||
inverse: void,
|
inverse: void,
|
||||||
|
reset_inverse: void,
|
||||||
|
|
||||||
/// Set foreground color as RGB values.
|
/// Set foreground color as RGB values.
|
||||||
direct_color_fg: RGB,
|
direct_color_fg: RGB,
|
||||||
@ -83,6 +84,8 @@ pub const Parser = struct {
|
|||||||
|
|
||||||
7 => return Attribute{ .inverse = {} },
|
7 => return Attribute{ .inverse = {} },
|
||||||
|
|
||||||
|
27 => return Attribute{ .reset_inverse = {} },
|
||||||
|
|
||||||
30...37 => return Attribute{
|
30...37 => return Attribute{
|
||||||
.@"8_fg" = @intToEnum(color.Name, slice[0] - 30),
|
.@"8_fg" = @intToEnum(color.Name, slice[0] - 30),
|
||||||
},
|
},
|
||||||
@ -194,8 +197,15 @@ test "sgr: bold" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test "sgr: inverse" {
|
test "sgr: inverse" {
|
||||||
const v = testParse(&[_]u16{7});
|
{
|
||||||
try testing.expect(v == .inverse);
|
const v = testParse(&[_]u16{7});
|
||||||
|
try testing.expect(v == .inverse);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const v = testParse(&[_]u16{27});
|
||||||
|
try testing.expect(v == .reset_inverse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test "sgr: 8 color" {
|
test "sgr: 8 color" {
|
||||||
|
Reference in New Issue
Block a user