Skip to content

Commit 58875fe

Browse files
[[ BUg 14406 ]] Fix ported to 7.0
1 parent b93dcd6 commit 58875fe

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

docs/notes/bugfix-14406.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Unable to enter Chinese characters in script editor

engine/src/desktop.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,10 @@ void MCPlatformHandleTextInputInsertText(MCPlatformWindowRef p_window, unichar_t
930930
t_char[1] = 0;
931931

932932
MCAutoStringRef t_string;
933-
if (s_pending_key_down -> next && MCUnicodeMapToNative(p_chars, 1, t_char[0]))
933+
// SN-2015-01-20: [[ Bug 14406 ]] If we have a series of pending keys, we have two possibilities:
934+
// - typing IME characters: the characters are native, so we use the finsertnew
935+
// - typing dead characters: the character, if we arrive here, is > 127
936+
if (*p_chars > 127 && s_pending_key_down -> next && MCUnicodeMapToNative(p_chars, 1, t_char[0]))
934937
{
935938
MCStringCreateWithNativeChars((const char_t *)t_char, 1, &t_string);
936939
MCdispatcher -> wkdown(p_window, *t_string, *t_char);
@@ -948,7 +951,9 @@ void MCPlatformHandleTextInputInsertText(MCPlatformWindowRef p_window, unichar_t
948951
// then that's not a combining char - and it deserves its (raw)Key(Down|Up) messages
949952
uint32_t t_codepoint;
950953
t_codepoint = MCStringGetCodepointAtIndex(*t_string, 0);
951-
if (p_char_count == 1 && MCUnicodeIsAlnum(t_codepoint))
954+
955+
// SN-2015-01-20: [[ Bug 14406 ]] Same as above: *p_chars > 127 means that we are in IME.
956+
if (*p_chars > 127 && p_char_count == 1 && MCUnicodeIsAlnum(t_codepoint))
952957
{
953958
MCAutoStringRef t_mapped_char;
954959
MCPlatformKeyCode t_mapped_key_code;

0 commit comments

Comments
 (0)