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

Incorrect cursor_range Calculation in Ime::Preedit #3967

Open
mitoma opened this issue Oct 24, 2024 · 1 comment
Open

Incorrect cursor_range Calculation in Ime::Preedit #3967

mitoma opened this issue Oct 24, 2024 · 1 comment
Labels
B - bug Dang, that shouldn't have happened DS - windows

Comments

@mitoma
Copy link

mitoma commented Oct 24, 2024

Description

When using the Japanese IME (Microsoft IME) with winit, the cursor_range value in Ime::Preedit(text, cursor_range) becomes corrupted.

For example, when trying to convert the string “ぶたがなく” within the range of “ぶたが”, the cursor_range should ideally be "(start)🐖が(end)なく". However, it ends up being "(start)🐖がな(end)く", with the (end) position being off by one character.

This issue arises because the character “🐖” is passed as a UTF-16 surrogate pair in Windows. Although the cursor position attribute is also based on UTF-16, winit’s calculation of cursor_range does not account for surrogate pairs.

Please update the cursor_range calculation to handle surrogate pairs correctly.

Windows version

Microsoft Windows [Version 10.0.22631.4317]

Winit version

In versions 0.28.1 and later

@mitoma mitoma added B - bug Dang, that shouldn't have happened DS - windows labels Oct 24, 2024
@mitoma
Copy link
Author

mitoma commented Oct 24, 2024

In my case, it is working as expected after applying this patch.
mitoma@67bbf97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened DS - windows
Development

No branches or pull requests

1 participant