[PATCH 0/1] MR2001: Draft: 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 cc/ @aricstewart (has no Developer access to wine/wine; cannot be assigned as a reviewer yet) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2001
From: Jinoh Kang <jinoh.kang.kr(a)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..b4fd474ff87 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; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2001
Huw Davies (@huw) commented about dlls/riched20/editor.c:
return 0; case WM_IME_STARTCOMPOSITION: { - editor->imeStartIndex=ME_GetCursorOfs(&editor->pCursors[0]); ME_DeleteSelection(editor); + editor->imeStartIndex=ME_GetCursorOfs(&editor->pCursors[0]);
This looks fine to go in after 8.0. Minor nit, could you add spaces on either side of the `=`? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2001#note_21426
participants (3)
-
Huw Davies (@huw) -
Jinoh Kang -
Jinoh Kang (@iamahuman)