1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-23 14:05:03 -05:00

Very crude support for displaying pre-edit strings

We simply pass each character to term_display_graphic_char and then
put the cursor back where we found it.  This works in simple cases,
but is fundamentally wrong.  Really we should do this in a way that
doesn't touch the terminal state and just gets rendered on top of it
somehow.
This commit is contained in:
Ben Harris 2025-03-30 16:45:25 +01:00
parent 35caff4048
commit ab9dfc572e

View File

@ -8115,13 +8115,18 @@ void term_notify_window_size_pixels(Terminal *term, int x, int y)
void term_set_preedit_text(Terminal *term, char *preedit_text) void term_set_preedit_text(Terminal *term, char *preedit_text)
{ {
BinarySource src[1]; BinarySource src[1];
pos oldcurs = term->curs;
if (preedit_text != NULL) { if (preedit_text != NULL) {
debug("Pre-edit:"); debug("Pre-edit:");
BinarySource_BARE_INIT(src, preedit_text, strlen(preedit_text)); BinarySource_BARE_INIT(src, preedit_text, strlen(preedit_text));
while (get_avail(src)) while (get_avail(src)) {
debug(" U+%04X", decode_utf8(src, NULL)); unsigned int c = decode_utf8(src, NULL);
debug(" U+%04X", c);
term_display_graphic_char(term, c);
}
debug("\n"); debug("\n");
term->curs = oldcurs;
} else { } else {
debug("Pre-edit finished\n"); debug("Pre-edit finished\n");
} }