From 1f9bc0d42bc53fd04cc848da1da52635dcf7a2c0 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 20 Nov 2015 10:43:26 +1100 Subject: Bug [#1779]. Better Unicode input support on Windows systems. - support surrogate pairs in WM_CHAR messages - support characters from supplementary planes in WM_UNICHAR messages - support WM_UNICHAR messages in non-Unicode mode - fix some code duplication Also, do not return FALSE upon receiving a WM_UNICHAR message with a UNICODE_NOCHAR parameter, since WM_UNICHAR can actually be handled just fine (at least with the exact same level of support as WM_CHAR). --- src/UniConversion.cxx | 4 ---- src/UniConversion.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/UniConversion.cxx b/src/UniConversion.cxx index c12ca34c2..4da9e102a 100644 --- a/src/UniConversion.cxx +++ b/src/UniConversion.cxx @@ -19,10 +19,6 @@ using namespace Scintilla; namespace Scintilla { #endif -enum { SURROGATE_TRAIL_FIRST = 0xDC00 }; -enum { SURROGATE_TRAIL_LAST = 0xDFFF }; -enum { SUPPLEMENTAL_PLANE_FIRST = 0x10000 }; - unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { unsigned int len = 0; for (unsigned int i = 0; i < tlen && uptr[i];) { diff --git a/src/UniConversion.h b/src/UniConversion.h index 08898cac3..aeb13f0c2 100644 --- a/src/UniConversion.h +++ b/src/UniConversion.h @@ -57,6 +57,10 @@ inline bool UTF8IsNEL(const unsigned char *us) { enum { SURROGATE_LEAD_FIRST = 0xD800 }; enum { SURROGATE_LEAD_LAST = 0xDBFF }; +enum { SURROGATE_TRAIL_FIRST = 0xDC00 }; +enum { SURROGATE_TRAIL_LAST = 0xDFFF }; +enum { SUPPLEMENTAL_PLANE_FIRST = 0x10000 }; + inline unsigned int UTF16CharLength(wchar_t uch) { return ((uch >= SURROGATE_LEAD_FIRST) && (uch <= SURROGATE_LEAD_LAST)) ? 2 : 1; } -- cgit v1.2.3