Skip to content

Anchor IME cursor area at the text input caret - #844

Open
nicoburns wants to merge 1 commit into
devin/1788875289-ime-autofocusfrom
devin/1788875473-ime-cursor-area
Open

Anchor IME cursor area at the text input caret#844
nicoburns wants to merge 1 commit into
devin/1788875289-ime-autofocusfrom
devin/1788875473-ime-cursor-area

Conversation

@nicoburns

@nicoburns nicoburns commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

On macOS the IME candidate window appeared at the window's top-left instead of next to the caret. Two causes:

  1. blitz-shell: the IME was enabled with ImeCapabilities::new() (no cursor_area capability), so winit discarded every set_ime_cursor_area update (warn!("discarding IME cursor area update without capability enabled.") in winit-appkit) and firstRectForCharacterRange returned the view origin. BlitzShellProvider::set_ime_enabled(true) now requests ImeCapabilities::new().with_cursor_area(). Winit requires an initial cursor area in the enable request (ImeEnableRequest::new returns None otherwise), so the provider caches the last reported area in an ime_cursor_area: Mutex<(LogicalPosition, LogicalSize)> and passes it on enable.

  2. blitz-dom: the reported area was the input's whole content box. Node::ime_cursor_area() now returns the caret rect from editor.cursor_geometry(1.5), converted from Parley's scaled pixels to CSS pixels and offset by the same vertical-centering and scroll_offset adjustments the painter applies, so the IME anchor follows the caret as the user types (sync_ime_cursor_area in resolve() 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 be main once 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.

@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant