Skip to content

Windows: Fix Incorrect cursor_range Calculation in Ime::Preedit - #4201

Merged
kchibisov merged 4 commits into
rust-windowing:masterfrom
mitoma:fix-ime-preedit-on-windows-0.30
Apr 29, 2025
Merged

kchibisov merged 4 commits into
rust-windowing:masterfrom
mitoma:fix-ime-preedit-on-windows-0.30

Conversation

@mitoma

@mitoma mitoma commented Apr 22, 2025

Copy link
Copy Markdown
Contributor

This pull request resolves the Ime::Preedit issue reported in #3967.
The issue arises because text is based on UTF-8 while attribute is based on UTF-16, leading to misalignment in cursor positioning.

  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

@mitoma
mitoma requested a review from notgull as a code owner April 22, 2025 14:53
@mitoma
mitoma force-pushed the fix-ime-preedit-on-windows-0.30 branch from dad591a to e2cdeca Compare April 22, 2025 15:07
@madsmtm madsmtm added B - bug Dang, that shouldn't have happened DS - win32 Affects the Win32/Windows backend labels Apr 22, 2025
@mitoma
mitoma force-pushed the fix-ime-preedit-on-windows-0.30 branch 2 times, most recently from 689efa1 to 669086e Compare April 29, 2025 06:21
Comment thread src/platform_impl/windows/ime.rs Resolved
mitoma added 2 commits April 29, 2025 20:04
The `text` is retrieved as UTF-8 while `attributes` are based on UTF-16.
This commit introduces a mapping between UTF-8 and UTF-16 indices to
ensure proper handling of IME composition ranges and cursor positions.
@mitoma
mitoma force-pushed the fix-ime-preedit-on-windows-0.30 branch from 5aa687f to 14025b4 Compare April 29, 2025 11:04

@kchibisov kchibisov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good, needs a changelog entry, like: On Windows, fix Ime::Preedit cursor offset calculation.

@mitoma

mitoma commented Apr 29, 2025

Copy link
Copy Markdown
Contributor Author

@kchibisov
I wrote a changelog. Since it was a platform-specific fix, it should have been grouped and sorted, but since the current state is broken, I just added it to the end to avoid conflicts.

@kchibisov
kchibisov merged commit e634cc6 into rust-windowing:master Apr 29, 2025
@kchibisov

Copy link
Copy Markdown
Member

Thanks.

@kchibisov kchibisov added this to the Version 0.30.10 milestone Apr 29, 2025
@kchibisov

kchibisov commented Apr 29, 2025 •

Copy link
Copy Markdown
Member

I wrote a changelog. Since it was a platform-specific fix, it should have been grouped and sorted, but since the current state is broken, I just added it to the end to avoid conflicts.

We generally don't sort alphabetically and entries are in chronological order. Hence why there's no mention of any sorting in changelog.md.

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 - win32 Affects the Win32/Windows backend

Development

Successfully merging this pull request may close these issues.

3 participants