From 5c5c59cbfcb38072b79a0d8a20fcc13c9b13be50 Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Mon, 24 Feb 2025 17:11:22 +0100 Subject: [PATCH] fix(style): render only necessary bytes and change default fg color to `.default` --- src/style.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/style.zig b/src/style.zig index d14ea5a..21ac0a7 100644 --- a/src/style.zig +++ b/src/style.zig @@ -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", .{}); }