1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 07:03:14 -04:00
Files
egui/crates
Umaĵo f32727ddca Improve IME, and restrict mac-specific workaround (#7973)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

* Closes N/A
* [x] I have followed the instructions in the PR template

My PR that fixes the macOS backspacing issue (#7810) unfortunately
breaks text selection on Wayland (Fedora KDE Plasma Desktop 43 [Wayland,
with or without IBus]). I had actually tested on a Wayland setup but
failed to notice that :(

Windows and Linux+X11 (Debian 13 [Cinnamon 6.4.10 + X11 + fcitx5 5.1.2])
are not affected.

This PR fixes the issue by restricting the macOS fix to macOS-only.

<details><summary>Here is the correct behavior on Wayland after this PR
(and before #7810 is applied)</summary>

![2026-03-13 5 25
24 PM](https://github.com/user-attachments/assets/3b0831c1-1d96-4003-9109-4bfe68e06d40)
</details>

<details><summary>Here is the buggy behavior on Wayland before this
PR</summary>

![2026-03-13 5 31
58 PM](https://github.com/user-attachments/assets/c6d69382-0104-4e38-ad47-2d431f83f1fa)
</details>

## Cause of the Wayland issue

On Wayland, `winit` constantly emits `winit::event::Ime::Preedit("",
None)` events.

PR #7810 added these lines for handling `winit::event::Ime::Preedit(_,
None)` in `egui-winit` without considering the `target_os`:

14afefa252/crates/egui-winit/src/lib.rs (L619-L621)

As a result, while text is being selected, `egui-winit` receives these
`winit::event::Ime::Preedit("", None)` events from `winit` and forwards
them to `egui` as `egui::ImeEvent::Preedit("")`. `egui` then clears the
current text selection, because it currently does not distinguish
between IME pre-edit text and selected text.

---------

Co-authored-by: lucasmerlin <hi@lucasmerlin.me>
2026-03-16 20:09:07 +01:00
..
2026-03-16 11:56:07 +01:00
2026-03-16 11:56:07 +01:00