Skip to content

Fix: Backspace behavior in command palette on Linux.#521

Merged
zxq82lm merged 2 commits intomainfrom
fix/backspace-command-palette
Feb 23, 2026
Merged

Fix: Backspace behavior in command palette on Linux.#521
zxq82lm merged 2 commits intomainfrom
fix/backspace-command-palette

Conversation

@zxq82lm
Copy link
Copy Markdown
Contributor

@zxq82lm zxq82lm commented Feb 23, 2026

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:

  1. IME capturing key events (root cause): bevy_egui's process_ime_system calls set_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 regular KeyboardInput events. 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 setting enable_ime = false on EguiContextSettings on Linux.

  2. 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() > 1 guard and switching from read-only key_pressed() to consume_key() for proper event consumption.

Test plan

  • Open command palette on Linux, type text, verify Backspace deletes characters normally
  • Verify arrow keys work in the command palette search field on Linux
  • Navigate into a sub-page, clear the filter, press Backspace — should return to the previous page
  • On the top-level page with empty filter, press Backspace — should be a no-op
  • Verify no regression on macOS

@zxq82lm zxq82lm changed the title Fix backspace in command palette on Linux Fix: Backspace behavior in command palette on Linux Feb 23, 2026
@zxq82lm zxq82lm marked this pull request as draft February 23, 2026 20:34
@zxq82lm zxq82lm changed the title Fix: Backspace behavior in command palette on Linux Fix: Backspace behavior in command palette on Linux. Feb 23, 2026
@zxq82lm zxq82lm added the linux Involves Linux at some level label Feb 23, 2026
@zxq82lm zxq82lm marked this pull request as ready for review February 23, 2026 22:16
@zxq82lm
Copy link
Copy Markdown
Contributor Author

zxq82lm commented Feb 23, 2026

  • Linux-tested successfully on b99eb17
  • No regression on macOS

zxq82lm and others added 2 commits February 23, 2026 14:19
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>
@zxq82lm zxq82lm force-pushed the fix/backspace-command-palette branch from b99eb17 to 0c95a09 Compare February 23, 2026 22:20
Copy link
Copy Markdown
Contributor

@x46085 x46085 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, LGTM

@zxq82lm zxq82lm enabled auto-merge (squash) February 23, 2026 22:23
@zxq82lm zxq82lm merged commit 66d9188 into main Feb 23, 2026
11 checks passed
@zxq82lm zxq82lm deleted the fix/backspace-command-palette branch February 23, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linux Involves Linux at some level

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants