Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Win32] Fixes improper IME composition ignorance #14664

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

gehongyan
Copy link
Contributor

@gehongyan gehongyan commented Feb 20, 2024

What does the pull request do?

When focusing on an input element, it goes through a series of calls, ultimately reaching the Imm32InputMethod.Reset method via TextInputMethodManager.TryFindAndApplyClient. Within this method, a task submitted to the UI thread sets _ignoreComposition to true, ignoring the first typed character or the first selected candidate word to be submitted at the end of string composition.

This incorrect behavior was introduced in #11723, resolving issue #11292. However, the current solution introduces another problem, as described in #14663.

What is the current behavior?

When the focus changes, _ignoreComposition is set to true as described above, and is reset to false when handling the next composition message.

if (_ignoreComposition)
{
_ignoreComposition = false;
return;
}

However, if there is no unfinished composition when switching focus, _ignoreComposition remains true, causing the next composition message to be unexpectedly ignored.

What is the updated/expected behavior with this PR?

_ignoreComposition should not be kept true when no uncompleted string compositions exist, so that the next string composition message can be handled well.

How was the solution implemented (if it's not obvious)?

The current merge request introduces a condition before setting _ignoreComposition to true. It only sets _ignoreComposition to true when there is ongoing input method string composition, namely IsComposing is true. This prevents _ignoreComposition from being inadvertently retained, addressing issue #14663.

Checklist

Breaking changes

None.

Obsoletions / Deprecations

None.

Fixed issues

Fixes #14663
Fixes #13881

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0045147-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

Copy link
Contributor

@Gillibald Gillibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your detailed PR

This is very much appreciated!

@maxkatz6 maxkatz6 added this pull request to the merge queue Feb 20, 2024
Merged via the queue into AvaloniaUI:master with commit 175673f Feb 21, 2024
6 checks passed
@Gillibald Gillibald added the backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch label Feb 21, 2024
@gehongyan gehongyan deleted the fix-ime-char-loss branch February 22, 2024 05:24
@maxkatz6 maxkatz6 added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants