Anchor IME cursor area at the text input caret - #844
Open
nicoburns wants to merge 1 commit into
Open
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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 macOS the IME candidate window appeared at the window's top-left instead of next to the caret. Two causes:
blitz-shell: the IME was enabled withImeCapabilities::new()(nocursor_areacapability), so winit discarded everyset_ime_cursor_areaupdate (warn!("discarding IME cursor area update without capability enabled.")inwinit-appkit) andfirstRectForCharacterRangereturned the view origin.BlitzShellProvider::set_ime_enabled(true)now requestsImeCapabilities::new().with_cursor_area(). Winit requires an initial cursor area in the enable request (ImeEnableRequest::newreturnsNoneotherwise), so the provider caches the last reported area in anime_cursor_area: Mutex<(LogicalPosition, LogicalSize)>and passes it on enable.blitz-dom: the reported area was the input's whole content box.Node::ime_cursor_area()now returns the caret rect fromeditor.cursor_geometry(1.5), converted from Parley's scaled pixels to CSS pixels and offset by the same vertical-centering andscroll_offsetadjustments the painter applies, so the IME anchor follows the caret as the user types (sync_ime_cursor_areainresolve()re-reports whenever it changes). Falls back to the content box if no text layout exists yet.Stacked on #843 (needs
ime_cursor_area/sync_ime_cursor_area); base will bemainonce that merges. The unit test from #843 is extended to check the caret-shaped area and that it moves right after typing.Found during the macOS smoke test of #614 (pre-existing on
main).Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/a737411590c54bbb833aa9167f89ac51
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/a737411590c54bbb833aa9167f89ac51?variant=devin-insiders
Requested by: @nicoburns
WPT results
No changes in test results compared to
main.Generated by the WPT workflow.