From 88dcde3ed8b30c14a5d834d0e88f9b4a5f584939 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 6 Feb 2025 07:31:30 +0100 Subject: term: insert-mode: handle combining characters correctly When the client application emits combining characters, for example multi-codepoint emojis, in insert-mode, we ended up pushing partial graphemes to the right, for each codepoint, resulting in too many cells (and with the wrong content) being inserted. The fix is fairly simple; don't "insert" when appending characters to an existing grapheme cluster. This isn't something we can detect easily in print_insert() (it would require us to do grapheme clustering again). Fortunately, we do have the required information in action_utf8_print(). So, pass this information as a boolean to term_print(). Closes #1947 --- csi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'csi.c') diff --git a/csi.c b/csi.c index 61cbdced..b982023c 100644 --- a/csi.c +++ b/csi.c @@ -793,7 +793,7 @@ csi_dispatch(struct terminal *term, uint8_t final) const int width = c32width(term->vt.last_printed); if (width > 0) { for (int i = 0; i < count; i++) - term_print(term, term->vt.last_printed, width); + term_print(term, term->vt.last_printed, width, false); } } break; -- cgit v1.3