https://bugs.winehq.org/show_bug.cgi?id=55055
Bug ID: 55055 Summary: Japanese IME fails to clear composition string when deleting the only remaining character Product: Wine Version: 8.10 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: imm32 Assignee: wine-bugs@winehq.org Reporter: achurch+wine@achurch.org Distribution: ---
Created attachment 74617 --> https://bugs.winehq.org/attachment.cgi?id=74617 PoC patch
Environment: Linux, LANG=ja_JP.UTF-8, ATOK X3 (XIM)
Since Wine 8.9 (and possibly 8.8, but not in 8.7), if XIM input results in a composition string being reduced to zero length, the previous composition string remains displayed until further input. For example, using Japanese:
1) Press 'A' -> composition string "あ" -> program displays "あ" 2) Press backspace -> composition string empty -> program still displays "あ" 3) Press 'I' -> composition string "I" -> program displays "い"
In step 2, the program should no longer display a composition string, but the "あ" from step 1 remains displayed until further input in step 3 (at which point the displayed composition string is correct again).
I first observed this in Final Fantasy XIV, but it reproduces in Notepad as well.
Changing dlls/imm32/ime.c:ImeToAsciiEx() to send WM_IME_ENDCOMPOSITION when compstr->dwCompStrLen is zero (see attached patch) seems to fix the bug without any side effects in FFXIV and Notepad, but I have no idea what other effects this might have, or if there needs to be some sort of deeper state tracking for a proper fix.