From 921f09450924936625df6c1c855e3cfeac47cf7a Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Tue, 23 Sep 2025 14:04:58 -0600 Subject: [PATCH] workaround crash when rendering some utf8 on win32 gui closes #194 Ignores cells that have graphemes with more than 1 codepoint rather than crash. --- src/win32/gui.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/win32/gui.zig b/src/win32/gui.zig index bab2196..d1bcaed 100644 --- a/src/win32/gui.zig +++ b/src/win32/gui.zig @@ -1086,7 +1086,10 @@ fn WndProc( var prev_codepoint: u21 = undefined; for (global.screen.buf, global.render_cells.items) |*screen_cell, *render_cell| { const width = screen_cell.char.width; - const codepoint = if (std.unicode.utf8ValidateSlice(screen_cell.char.grapheme)) + // temporary workaround, ignore multi-codepoint graphemes + const codepoint = if (screen_cell.char.grapheme.len > 4) + std.unicode.replacement_character + else if (std.unicode.utf8ValidateSlice(screen_cell.char.grapheme)) std.unicode.wtf8Decode(screen_cell.char.grapheme) catch std.unicode.replacement_character else std.unicode.replacement_character;