Skip to content

Commit

Permalink
gwidth: fix gwidth for no_zwj case
Browse files Browse the repository at this point in the history
  • Loading branch information
rockorager committed Mar 19, 2024
1 parent 15c64a0 commit 8a5fe1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gwidth.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
}
Expand Down

0 comments on commit 8a5fe1a

Please sign in to comment.