fix(style): render only necessary bytes and change default fg color to .default
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 45s

This commit is contained in:
2025-02-24 17:11:22 +01:00
parent c022d1d9e2
commit 5c5c59cbfc

View File

@@ -34,7 +34,7 @@ pub const Emphasis = enum(u8) {
strikethrough,
};
fg: Color = .white,
fg: Color = .default,
bg: Color = .default,
ul: Color = .default,
ul_style: Underline = .off,
@@ -63,7 +63,7 @@ pub fn value(this: Style, writer: anytype, cp: u21) !void {
for (this.emphasis) |attribute| try std.fmt.format(writer, ";{d}", .{@intFromEnum(attribute)});
try std.fmt.format(writer, "m", .{});
// content
try std.fmt.format(writer, "{s}", .{buffer});
try std.fmt.format(writer, "{s}", .{buffer[0..bytes]});
try std.fmt.format(writer, "\x1b[0m", .{});
}