fix: do not panic when the window cannot provide an IME - #1088
Open
criccomini wants to merge 1 commit into
Open
criccomini wants to merge 1 commit into
criccomini wants to merge 1 commit into
Conversation
Focusing a view that allows IME, such as a text input or the editor, sends SetImeAllowed, and the handler unwrapped the window's answer. The headless mock window refuses every IME request with NotSupported, so any headless test that focused a text input panicked; a platform without an IME would bring the app down the same way. Route the enable, disable and cursor-area requests through one helper that drops the refusal: the view still takes focus and works, it just gets no composition input. A headless test clicks into a text input to keep it that way. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
criccomini
added a commit
to criccomini/floem
that referenced
this pull request
Sep 21, 2026
Alt with an arrow is a word movement in a text box, and it is also the key floem's default action walks the focus with: after the handlers, `handle_default_behaviors` sends the focus to the nearest keyboard- navigable neighbour in the arrow's direction unless one of them prevented the default. The editor moved its cursor by the word and let the default run, so the focus left for a button beside it and the next keystroke went there. The text input did the same, and at the front of its buffer, with no word to move to, it reported the key unhandled as well. The editor now prevents the default for any key it ran a command for, as it already did for Tab: a key it has a command for is its own. The text input prevents it for an arrow whether or not the cursor could move by it, the way a native field never gives up the keyboard on one. The test gives a box the keyboard headlessly, which needs the mock window to take a refused IME request (lapce#1088). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> (cherry picked from commit 4d92f6a5bec9c3023cde8982a3521627ede53fb9)
20 tasks
This branch has not been deployed
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.
Focusing a view that allows IME — a text input, or the editor — sends
SetImeAllowed, andWindowHandleunwrapped the window's answer:The headless
MockWindowrefuses every IME request withImeRequestError::NotSupported, so anyHeadlessHarnesstest that clicked into a text input panicked atsrc/window/handle.rs:1270. A platform without an IME would take the app down the same way.This routes the enable, disable and cursor-area requests through one helper that drops the refusal: the view still takes focus and works, it just gets no composition input. A new headless test (
tests/headless_ime.rs) clicks into aTextInput, which panics before this change and passes after it.Found while writing headless tests for an editor-based app: every test that pressed the editor hit this.
🤖 Generated with Claude Code