From 8a5fe1a8ab7c5b99308db3e045b657974ee316b3 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 19 Mar 2024 13:20:00 -0500 Subject: [PATCH] gwidth: fix gwidth for no_zwj case --- src/gwidth.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gwidth.zig b/src/gwidth.zig index abf560a..f41f37d 100644 --- a/src/gwidth.zig +++ b/src/gwidth.zig @@ -31,7 +31,8 @@ pub fn gwidth(str: []const u8, method: Method) !usize { .no_zwj => { var out: [256]u8 = undefined; if (str.len > out.len) return error.OutOfMemory; - const n = std.mem.replace(u8, str, "\u{200D}", "", &out); + const n = std.mem.replacementSize(u8, str, "\u{200D}", ""); + _ = std.mem.replace(u8, str, "\u{200D}", "", &out); return gwidth(out[0..n], .unicode); }, }