X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/9657ac3d30e1c8d3aefa13054af5851fe2f3c3d2..f41f07bcc3c099e88e9d8e5f0fd597c011469174:/terminal.c diff --git a/terminal.c b/terminal.c index 19d5a750..996a01fb 100644 --- a/terminal.c +++ b/terminal.c @@ -5262,8 +5262,17 @@ static void clipme(Terminal *term, pos top, pos bottom, int rect, int desel) set = (uc & CSET_MASK); c = (uc & ~CSET_MASK); - cbuf[0] = uc; - cbuf[1] = 0; +#ifdef PLATFORM_IS_UTF16 + if (uc > 0x10000 && uc < 0x110000) { + cbuf[0] = 0xD800 | ((uc - 0x10000) >> 10); + cbuf[1] = 0xDC00 | ((uc - 0x10000) & 0x3FF); + cbuf[2] = 0; + } else +#endif + { + cbuf[0] = uc; + cbuf[1] = 0; + } if (DIRECT_FONT(uc)) { if (c >= ' ' && c != 0x7F) { @@ -5942,7 +5951,7 @@ void term_key(Terminal *term, Key_Sym keysym, wchar_t *text, size_t tlen, if (modifiers & PKM_CONTROL) c &= 0x1f; else if (modifiers & PKM_SHIFT) - c = toupper(c); + c = toupper((unsigned char)c); } *p++ = c; goto done;