small stylistic changes

This commit is contained in:
Mitchell Hashimoto
2024-08-24 19:55:01 -07:00
parent b8d4969fee
commit 8e2d63b6fa
2 changed files with 10 additions and 20 deletions

View File

@ -36,8 +36,8 @@ pub const Kind = union(enum) {
special: Special,
pub fn parse(key: []const u8) ?Kind {
if (std.meta.stringToEnum(Special, key)) |s| return Kind{ .special = s };
return Kind{ .palette = std.fmt.parseUnsigned(u8, key, 10) catch return null };
if (std.meta.stringToEnum(Special, key)) |s| return .{ .special = s };
return .{ .palette = std.fmt.parseUnsigned(u8, key, 10) catch return null };
}
pub fn format(

View File

@ -1345,25 +1345,20 @@ pub const StreamHandler = struct {
self.terminal.color_palette.colors[palette] = v.color;
self.terminal.color_palette.mask.unset(palette);
},
.special => |special| {
const msg: renderer.Message = switch (special) {
.foreground => msg: {
self.foreground_color = v.color;
break :msg .{
.foreground_color = v.color,
};
break :msg .{ .foreground_color = v.color };
},
.background => msg: {
self.background_color = v.color;
break :msg .{
.background_color = v.color,
};
break :msg .{ .background_color = v.color };
},
.cursor => msg: {
self.cursor_color = v.color;
break :msg .{
.cursor_color = v.color,
};
break :msg .{ .cursor_color = v.color };
},
else => {
log.warn(
@ -1385,25 +1380,20 @@ pub const StreamHandler = struct {
self.terminal.color_palette.colors[palette] = self.terminal.default_palette[palette];
self.terminal.color_palette.mask.unset(palette);
},
.special => |special| {
const msg: renderer.Message = switch (special) {
.foreground => msg: {
self.foreground_color = self.default_foreground_color;
break :msg .{
.foreground_color = self.default_foreground_color,
};
break :msg .{ .foreground_color = self.default_foreground_color };
},
.background => msg: {
self.background_color = self.default_background_color;
break :msg .{
.background_color = self.default_background_color,
};
break :msg .{ .background_color = self.default_background_color };
},
.cursor => msg: {
self.cursor_color = self.default_cursor_color;
break :msg .{
.cursor_color = self.default_cursor_color,
};
break :msg .{ .cursor_color = self.default_cursor_color };
},
else => {
log.warn(