Single line TextEdit ignores input after repeated calls to request_focus()
Describe the bug Attempting to call request_focus() on a single line text edit every time it loses focus will eventually cause the TextEdit to ignore any further key presses.
This happens on native build (egui 0.29) for Linux with eframe. Have not tested on MacOS or Windows. Does not occur on webassembly build (tested in firefox)
To Reproduce Steps to reproduce the behavior:
- Checkout the latest eframe_template (using egui 0.29)
- Replace this line:
ui.text_edit_singleline(&mut self.label);with this block (the point being to restore focus on the input field every time after pressing enter):let response = ui.text_edit_singleline(&mut self.label); if !response.has_focus() { response.request_focus(); } - Run the demo and type something in the test box and hit enter
- Notice that focus was restored to the text box
- Type some more characters, then hold down the enter key for a few seconds
- Try to type some more characters
- Notice that the text field now ignores all further input (if problem doesn't yet occur, repeat step 5 - this is reproducible every time on my system after a few attempts at most)
Expected behavior Regardless of how many times the text box loses focus due to pressing enter, the focus should still be restored and the text box should accept further input.
Desktop (please complete the following information): Tested on Linux Mint with egui 0.29
Problem does not occur on wasm build (tested in Firefox)
Please check if this was solved by
- https://github.com/emilk/egui/pull/5188
Please check if this was solved by
* [Linux: Disable IME to fix backspace/arrow keys #5188](https://github.com/emilk/egui/pull/5188)
I tested again with the fix for #5188 but that update doesn't resolve this issue.
Still having this bug. sometimes it works, but most times it doesn't