Repository navigation
Respect IME preedit cursor position on Win32 - #21632
Conversation
|
You can test this PR using the following package version. |
|
|
@cla-avalonia agree |
|
You can test this PR using the following package version. |
398da5f to
63a772c
Compare
|
You can test this PR using the following package version. |
63a772c to
c39499b
Compare
|
You can test this PR using the following package version. |
MrJul
left a comment
There was a problem hiding this comment.
Tested with both Japanese and Chinese IME (MS Pinyin). Moving the caret works as advertised.
LGTM!
|
Can this PR backport to 11.3.x branch? |
No, 11.3 won't receive any new updates (unless it's a security fix). If you have an enterprise support agreement, you can contact the team to request additional fixes. |
|
@gotoh Thanks, using the test version can resolve the issue. |
What does the pull request do?
This PR fixes Win32 IME preedit caret handling in
Imm32InputMethod.When IMM32 reports
GCS_CURSORPOS, Avalonia now forwards that caret position toTextInputMethodClient.SetPreeditText, so the visual caret in the preedit string stays in sync with the actual IME composition cursor.The change is limited to the Win32 IMM32 path and does not modify the higher-level text input model or platform-independent preedit behavior.
What is the current behavior?
On Windows, Avalonia updates the preedit text content, but it does not track the caret position inside the active composition string.
As a result, when editing an in-progress IME composition, the logical caret can move inside the composition string while the visual preedit caret remains stale, typically staying at the end.
What is the updated/expected behavior with this PR?
Avalonia now updates the preedit caret position together with the preedit text on the Win32 IMM32 path.
This makes the caret follow IME cursor movement correctly when editing an active composition string, including cases where the user returns from conversion to composition editing and moves the caret within the preedit text.
Manual verification was done with Japanese IME on Windows 10/11 using
samples/ControlCatalog.Desktop(TextBoxpage), including both Google IME and Microsoft IME.How was the solution implemented (if it's not obvious)?
Imm32InputMethodGCS_CURSORPOSupdates toTextInputMethodClient.SetPreeditTextGCS_RESULTSTRandGCS_CURSORPOSare reported together without a newGCS_COMPSTRChecklist
Breaking changes
None.
Obsoletions / Deprecations
None.
Fixed issues
Fixes #10933
Likely fixes #21618 as well, since the reported symptom matches this Win32 IMM32 caret synchronization issue. However, my manual verification for this PR was performed with Japanese IMEs (Google IME and Microsoft IME), not with a Chinese IME specifically.