Repository navigation
feat(window): emit native text input events - #1441
Conversation
…d fail macOS: BendView is an NSTextInputClient; keyDown goes through interpretKeyEvents, and insertText sends Text, so input methods and dead keys reach it and arrows, Enter and Backspace stay Keys. Linux: open the input method under the user's locale (XMODIFIERS, else Xlib's own); without one, Text comes from the key's symbol instead of Window.open failing. A key the method takes is still one Key. Text rides in the existing five-word event: up to 16 UTF-8 bytes, cut between characters, control characters dropped.
3b4df59 to
7c8faee
Compare
|
Rebased on main and pushed follow-up commits (255d3a9, 5f71867, 7c8faee). Still not working: the macOS input method is incomplete. What changed:
Tested:
Still broken on macOS:
Unsupervised AI review. |
|
Thanks for the concrete Korean/Japanese reproductions. I will not claim the macOS IME path fixed from the green gates or the earlier Linux input proof. The available workstation is Linux, with no macOS host or configured SSH target; I cannot exercise the reported NSTextInputClient callbacks here. I also removed the interrupted, unverified marked-text experiment from my local worktree rather than publishing it. The remaining prerequisite is a macOS run capturing setMarkedText/insertText/unmarkText plus selectedRange/markedRange through Korean 2-set composition and Japanese candidate commit. selectedRange = NSNotFound remains a hypothesis, not a confirmed cause. I am keeping #1022 caret/composition work out of this PR and will not push another speculative AppKit patch. |
Apple's 2-Set Korean method commits the bare jamo of the first key a view gets (insertText ㅎ) instead of starting a syllable, so g k s gave ㅎ ㅏ ㄴ. keyDown now holds the commits of one interpretation; when the only one is a single compatibility jamo, with no composition before and no other callback, it interprets the key once more, and the method composes. Same workaround as winit#4744. Tested on macOS with real CGEvent keys: Korean g k s / d k s / s k f r give 한 안 낡; Japanese romaji gives あい and 日本語 on Return; US keys unchanged.
|
Pushed e97225b: fixes the macOS Korean bug. Cause. Apple's 2-Set Korean input method commits the bare jamo for the first key a view gets ( Fix.
Everything else works as before. The change is in the macOS ( Tested on macOS, with real CGEvent keys going through the system input methods to the
Not tested: the Linux laptop. The change doesn't build there. This comment and commit were written by an AI agent (Unii) working for @nicolas-abril, without human review. |
Generalizes the Korean first-jamo replay to any non-keylayout input source. Vietnamese Telex lost its first composition the same way (d d i gave "d" + "di" instead of "đi").
More macOS input methods tested on 5bc01f1, typing real key events (CGEvent) into a plain NSTextView, a bare NSTextInputClient view, and a Bend
Switching input methods mid-run (Vietnamese → Korean → Vietnamese) also works. Fix in 5bc01f1: Vietnamese Telex had the same first-key bug as Korean: Known limits (not changed):
Gates on this branch merged with main: repo 54/54, ping 57/57, test 1630/1630, perf 124/124 (macOS M4). Linux, CUDA and the cluster weren't run again; this commit only changes the macOS code. |
Closes #1019.
Change
Text{text: String}to native window events.Keykeeps its original canonical codes; text follows key-down when the OS supplies characters.Xutf8LookupString, preserving the original event before the legacy key-code lookup changes its modifiers. Focus and input-context resources follow the window lifetime. A missing UTF-8 context returnsENOTSUPinstead of silently offering partial text input.NSEvent.characterswithout lowercasing.Exercised verification
Actual native Linux window on an isolated X11 display, not mocked events:
Limits
macOS code was not built or exercised on this Linux workstation. This does not implement full IME editing (#1022). JavaScript native windows remain unsupported as before.
Release-note policy
Removed my unreleased changelog entry following maintainer review. CHANGELOG.md is now unchanged from main; implementation and previously exercised verification are unchanged.