Skip to content

Fix incorrect CandidateWindow position when using Pinyin IMEs in Windows #18759

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

Merged
merged 1 commit into from
May 9, 2025

Conversation

realybin
Copy link
Contributor

@realybin realybin commented Apr 30, 2025

What does the pull request do?

This pull request addresses an issue where the IME CandidateWindow is not correctly positioned when using Pinyin IMEs on Windows. The fix ensures that the CandidateWindow aligns properly with the caret position, improving user experience when typing Chinese characters with Pinyin Input Method Editors.

What is the current behavior?

The CandidateWindow's top position does not align correctly with the caret position. This behavior is inconsistent with most major UI frameworks and leads to a poor user experience when inputting Chinese characters using Pinyin IMEs.
This issue was observed in different Chinese IMEs, including older ones on Windows 7.

What is the updated/expected behavior with this PR?

The CandidateWindow now aligns correctly with the caret position. This behavior has been tested on multiple Chinese IMEs, including those available on Windows 7, and all display as expected.
The fix ensures compatibility across various IMEs and improves usability.

image
image

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

Most Chinese input methods after Windows XP have been improved. However, the input method implementation in Avalonia appears to be based on the IMESharp code, which in turn follows logic originating from Chromium's code as early as 2008 or even earlier. Windows 7 was officially released on October 22, 2009, while Windows Vista was released on November 30, 2006.

Will Avalonia's Windows input method switch to TSF in the future? TSF has been a modern framework since Windows XP.

Perhaps we can also refer to the implementations of WPF (TSF) and modern Chromium (TSF).

If we implement TSF, it may potentially resolve many of the previous IME-related issues, though the workload would be significant.

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #18748

@realybin realybin changed the title Fix incorrect ImeWindow position when using Pinyin IMEs Fix incorrect ImeWindow position when using Pinyin IMEs in Windows Apr 30, 2025
@realybin realybin changed the title Fix incorrect ImeWindow position when using Pinyin IMEs in Windows Fix incorrect CandidateWindow position when using Pinyin IMEs in Windows Apr 30, 2025
@avaloniaui-bot
Copy link

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

@cla-avalonia
Copy link
Collaborator

cla-avalonia commented Apr 30, 2025

  • All contributors have signed the CLA.

@realybin
Copy link
Contributor Author

@cla-avalonia agree

@avaloniaui-bot
Copy link

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

@Gillibald
Copy link
Contributor

TSF requires a text store implementation etc.

@realybin
Copy link
Contributor Author

realybin commented May 1, 2025

TSF requires a text store implementation etc.

I noticed that version 11.3.0-rc1 has already been released. Would it be possible to merge this bug fix before the final release of version 11.3.0? We may consider implementing this via TSF in the future. Thank you for your time and consideration!

@avaloniaui-bot
Copy link

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

@MrJul MrJul added the backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch label May 9, 2025
Copy link
Member

@MrJul MrJul 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! As a non-Chinese speaker, I've tested as best as I can, but this was obviously not exhaustive. I'm going to trust the screenshots here.

@MrJul MrJul added this pull request to the merge queue May 9, 2025
@realybin
Copy link
Contributor Author

realybin commented May 9, 2025

Thank you! As a non-Chinese speaker, I've tested as best as I can, but this was obviously not exhaustive. I'm going to trust the screenshots here.

Thank you!♥️

Merged via the queue into AvaloniaUI:master with commit 3b70265 May 9, 2025
11 checks passed
@MrJul MrJul added backported-11.3.x and removed backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch labels Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[IME] The CandidateWindow seems placed not correctly in Windows
5 participants