From 07a5dd044275849a16ad5fe68a4666770426687a Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 6 Apr 2024 10:28:57 -0700 Subject: [PATCH] config: FontStyle.clone --- src/config/Config.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/config/Config.zig b/src/config/Config.zig index eb4f21d18..34adf7b56 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -3248,6 +3248,14 @@ pub const FontStyle = union(enum) { }; } + /// Deep copy of the struct. Required by Config. + pub fn clone(self: Self, alloc: Allocator) !Self { + return switch (self) { + .default, .false => self, + .name => |v| .{ .name = try alloc.dupeZ(u8, v) }, + }; + } + /// Used by Formatter pub fn formatEntry(self: Self, formatter: anytype) !void { switch (self) {