SDL: Don't move the cursor to the end of the selected candidate

From 018ca39c45ee703e991ff35cefa9c005f950284f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 24 Jun 2024 17:41:06 -0700
Subject: [PATCH] Don't move the cursor to the end of the selected candidate

We might have legitimately moved the cursor to the beginning.

Fixes https://github.com/libsdl-org/SDL/issues/9761
---
 src/video/windows/SDL_windowskeyboard.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c
index 61dfe9da394c6..2863fd6d4e218 100644
--- a/src/video/windows/SDL_windowskeyboard.c
+++ b/src/video/windows/SDL_windowskeyboard.c
@@ -839,6 +839,7 @@ static void IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD
 
     videodata->ime_composition[length] = 0;
 
+#if 0 // At least with the Chinese IME, it's possible to move the cursor to the beginning of the selection, see https://github.com/libsdl-org/SDL/issues/9761 for details
     // Get the correct caret position if we've selected a candidate from the candidate window
     if (videodata->ime_cursor == 0 && length > 0) {
         Sint32 start = 0;
@@ -871,6 +872,7 @@ static void IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD
 
         videodata->ime_cursor = end;
     }
+#endif // 0
 }
 
 static void IME_SendInputEvent(SDL_VideoData *videodata)