Module: wine Branch: master Commit: 8c43577f0f9b4422d3641457c595c3998bd54a18 URL: https://gitlab.winehq.org/wine/wine/-/commit/8c43577f0f9b4422d3641457c595c39...
Author: Jinoh Kang jinoh.kang.kr@gmail.com Date: Tue Jan 24 01:08:10 2023 +0900
riched20: Obtain the composition start index after deleting selection.
Today, the Rich Edit control handles the WM_IME_STARTCOMPOSITION message by the computing the composition start position (imeStartIndex) _before_ calling ME_DeleteSelection(), which shifts the character positions after the range of deletion. If the selection were not empty, imeStartIndex immediately becomes stale, since it does not take into account the number of deleted characters before it.
Fix this by computing imeStartIndex after the ME_DeleteSelection() call.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54318
---
dlls/riched20/editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 57601745ab2..7b4f4b3cdf3 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -4099,8 +4099,8 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, return 0; case WM_IME_STARTCOMPOSITION: { - editor->imeStartIndex=ME_GetCursorOfs(&editor->pCursors[0]); ME_DeleteSelection(editor); + editor->imeStartIndex = ME_GetCursorOfs(&editor->pCursors[0]); ME_CommitUndo(editor); ME_UpdateRepaint(editor, FALSE); return 0;