From 6532408ba564b3e94c0a5319b58f73915eb08fa9 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 5 Apr 2025 18:35:57 +0100 Subject: [PATCH] Support combining characters in pre-edit strings Having the pre-edit string in a termline makes this almost trivial. --- terminal/terminal.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/terminal/terminal.c b/terminal/terminal.c index f05877f0..fff9391d 100644 --- a/terminal/terminal.c +++ b/terminal/terminal.c @@ -8154,6 +8154,16 @@ void term_set_preedit_text(Terminal *term, char *preedit_text) case -1: /* Ignore control characters. */ break; + case 0: + if (width == 0) { + width = 1; + resizeline(term, term->preedit_termline, width); + } + if (term->preedit_termline->chars[width - 1].chr == UCSWIDE) + add_cc(term->preedit_termline, width - 2, c); + else + add_cc(term->preedit_termline, width - 1, c); + break; case 1: width += 1; resizeline(term, term->preedit_termline, width);