1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Refactor: move Windows Korean IME workaround from egui to egui-winit

The bug is specific to `egui-winit` and is unlikely present in other
implementations. Applying the workaround in `egui` degrades implementations
that already behave correctly.
This commit is contained in:
umajho
2026-06-11 17:38:39 +08:00
parent 1d699a1ad5
commit fbd1ccd6a9
2 changed files with 14 additions and 15 deletions

View File

@@ -706,7 +706,20 @@ impl State {
text.get(..start_bytes).map(|s| s.chars().count()),
text.get(start_bytes..end_bytes).map(|s| s.chars().count()),
) {
Some(start_chars..start_chars + middle_chars)
if cfg!(target_os = "windows") && start_chars == 0 && middle_chars == 0
{
// Workaround for a bug on Windows where `winit`
// incorrectly reports the cursor position at
// the start of the preedit text during
// composition with the builtin Korean IME.
// See: https://github.com/emilk/egui/pull/8083#issuecomment-4206742668
// TODO(umajho): Remove this workaround once the
// `winit` bug is fixed and we've updated to a
// version that includes the fix.
None
} else {
Some(start_chars..start_chars + middle_chars)
}
} else {
log::warn!("ignoring {ime:?}'s range because it is invalid");
None