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
cc/ @aricstewart (has no Developer access to wine/wine; cannot be assigned as a reviewer yet)
-- v2: riched20: Obtain the composition start index after deleting selection.
From: Jinoh Kang jinoh.kang.kr@gmail.com
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;
On Tue Jan 24 14:17:12 2023 +0000, Jinoh Kang wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/2001/diffs?diff_id=28582&start_sha=4d4e8e5b3e73edb9412308d5cb3904ac6255c8e9#4013dcdcdf5f44a3eddc19832cea6a5c868983d6_4103_4103)
Done
Pipeline failure for 7e5a01fae347c5cec08d8273cd9f44aa229dc199 (https://gitlab.winehq.org/iamahuman/wine/-/pipelines/6611) is due to https://bugs.winehq.org/show_bug.cgi?id=53206
This merge request was approved by Huw Davies.