@@ -828,6 +828,11 @@ static void IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, LPARAM
828828 }
829829 length /= sizeof (WCHAR );
830830
831+ if (!(* lParam & GCS_CURSORPOS )) {
832+ // If the IME doesn't support GCS_CURSORPOS, default the cursor to the end of the composition.
833+ videodata -> ime_cursor = length ;
834+ }
835+
831836 if ((dwLang == LANG_CHT || dwLang == LANG_CHS ) &&
832837 videodata -> ime_cursor > 0 &&
833838 videodata -> ime_cursor < (int )(videodata -> ime_composition_length / sizeof (WCHAR )) &&
@@ -889,7 +894,7 @@ static void IME_SendInputEvent(SDL_VideoData *videodata)
889894
890895 videodata -> ime_composition [0 ] = 0 ;
891896 videodata -> ime_readingstring [0 ] = 0 ;
892- videodata -> ime_cursor = 1 ; // Korean IME cursor
897+ videodata -> ime_cursor = 0 ;
893898}
894899
895900static void IME_SendEditingEvent (SDL_VideoData * videodata )
@@ -1072,7 +1077,7 @@ bool WIN_HandleIMEMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SD
10721077 } else if (msg == WM_IME_STARTCOMPOSITION ) {
10731078 SDL_DebugIMELog ("WM_IME_STARTCOMPOSITION" );
10741079 if (videodata -> ime_internal_composition ) {
1075- videodata -> ime_cursor = 1 ; // Korean IME cursor
1080+ videodata -> ime_cursor = 0 ;
10761081 // Windows may still display a composition dialog even with
10771082 // ISC_SHOWUICOMPOSITIONWINDOW cleared, so trap the message
10781083 // here to prevent that (even when the IME is disabled).
0 commit comments