Skip to content

Backspace deletes characters in TextEdit during IME composition (CJK) #7908

@cats2333

Description

@cats2333

Describe the bug
When using a CJK (Chinese, Japanese, Korean) Input Method Editor (IME), pressing Backspace while in the composition state (pre-edit) incorrectly deletes characters from the TextEdit buffer. It seems the Backspace event is being "double-consumed" by both the IME (to remove a syllable/character in the candidate window) and the TextEdit widget (to remove a committed character in the box).

To Reproduce
Steps to reproduce the behavior:

Run an eframe application with a TextEdit widget.
Focus the TextEdit and switch to a Chinese IME (e.g., Sogou Pinyin or Microsoft Pinyin).
Type some letters (e.g., "ceshi") to open the IME candidate window.
Press Backspace to correct the pinyin.
You will see that while the pinyin is being corrected, the characters already existing in the input box are also being deleted.

Expected behavior
When the IME is active and has a pre-edit string (composition), the Backspace key should only be handled by the IME. egui should ignore the Backspace key event until the composition is finished or the candidate window is empty.

Screenshots

Image

Desktop (please complete the following information):

OS: Windows 10/11 (or macOS/Linux, please specify your OS)

Browser: N/A (Native eframe)

Version: egui/eframe 0.30

Additional context
I am using egui/eframe 0.30. This issue persists even in the latest versions. It appears that winit might not be marking the Backspace key as "consumed" when the IME is active, or egui's TextEdit is not checking the input.ime state before processing the backspace event. This significantly hinders the user experience for CJK users, especially when using third-party IMEs like Sogou.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions