From 6461e6719c56fe724ea951fd1ac331e3099ca6fd Mon Sep 17 00:00:00 2001 From: drust Date: Mon, 19 Feb 2024 03:26:08 +0000 Subject: [PATCH] Fixed the .len --- src/gwidth.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gwidth.zig b/src/gwidth.zig index ba4875a..abf560a 100644 --- a/src/gwidth.zig +++ b/src/gwidth.zig @@ -30,7 +30,7 @@ pub fn gwidth(str: []const u8, method: Method) !usize { }, .no_zwj => { var out: [256]u8 = undefined; - if (str.len > out) return error.OutOfMemory; + if (str.len > out.len) return error.OutOfMemory; const n = std.mem.replace(u8, str, "\u{200D}", "", &out); return gwidth(out[0..n], .unicode); },