From 35caff40488002c731aec3d92d98a3fc1a082d4f Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sun, 30 Mar 2025 15:05:31 +0100 Subject: [PATCH] Decode UTF-8 in pre-edit text This is a pre-requisite to rendering it somehow. --- terminal/terminal.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/terminal/terminal.c b/terminal/terminal.c index 3aac6960..5fc20b94 100644 --- a/terminal/terminal.c +++ b/terminal/terminal.c @@ -8114,5 +8114,15 @@ void term_notify_window_size_pixels(Terminal *term, int x, int y) */ void term_set_preedit_text(Terminal *term, char *preedit_text) { - debug("Pre-edit: %s\n", preedit_text); + BinarySource src[1]; + + if (preedit_text != NULL) { + debug("Pre-edit:"); + BinarySource_BARE_INIT(src, preedit_text, strlen(preedit_text)); + while (get_avail(src)) + debug(" U+%04X", decode_utf8(src, NULL)); + debug("\n"); + } else { + debug("Pre-edit finished\n"); + } }