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.