Fix: Backspace behavior in command palette on Linux.#521
Merged
Conversation
Contributor
Author
|
Workaround for emilk/egui#5008 — on Linux (X11/XWayland via nix develop), IME activation via set_ime_allowed(true) causes the display server to capture Backspace and arrow key events through XIM, preventing them from reaching egui TextEdit widgets. bevy_egui's process_ime_system calls set_ime_allowed(true) whenever a TextEdit gains focus. egui-winit fixed this in emilk/egui#5188 and emilk/egui#5198, but bevy_egui has its own input pipeline and still triggers the problematic path. Setting enable_ime = false on the EguiContextSettings prevents the call entirely. Co-authored-by: Cursor <cursoragent@cursor.com>
b99eb17 to
0c95a09
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Linux (X11/XWayland via nix develop), pressing Backspace in the command palette search field had no effect — users couldn't delete typed characters and had to Escape and re-open.
Two separate issues were at play:
IME capturing key events (root cause): bevy_egui's
process_ime_systemcallsset_ime_allowed(true)whenever a TextEdit gains focus. On Linux, this causes the display server to route Backspace and arrow key events through XIM instead of delivering them as regularKeyboardInputevents. This is a known egui bug (emilk/egui#5008) that was fixed in egui-winit (emilk/egui#5188, emilk/egui#5198), but bevy_egui has its own input pipeline and still triggers the problematic path. Fixed by settingenable_ime = falseonEguiContextSettingson Linux.Unnecessary page-pop on Backspace: The old code tried to pop the command palette page stack on every Backspace press with an empty filter, even on the top-level page (single entry). This caused a pointless pop-and-recreate cycle. Fixed by adding a
page_stack.len() > 1guard and switching from read-onlykey_pressed()toconsume_key()for proper event consumption.Test plan