From 7fa02cae9590a5a92828b305c1481fa76ffd2aca Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 19 Feb 2023 12:02:41 -0800 Subject: [PATCH] window charCallback accepts doesn't assume ASCII, accepts any Unicode CP --- src/Window.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Window.zig b/src/Window.zig index a104b1ee6..d5bc04eb3 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -741,11 +741,11 @@ pub fn charCallback(self: *Window, codepoint: u21) !void { // Ask our IO thread to write the data var data: termio.Message.WriteReq.Small.Array = undefined; - data[0] = @intCast(u8, codepoint); + const len = try std.unicode.utf8Encode(codepoint, &data); _ = self.io_thread.mailbox.push(.{ .write_small = .{ .data = data, - .len = 1, + .len = len, }, }, .{ .forever = {} });