Show input method composition in text fields - #10195
Open
hard25670559 wants to merge 1 commit into
Open
Conversation
Text being composed by an input method was invisible until it was committed, so typing anything through an IME looked like nothing was happening. Take the composition state the engine now reports and draw it at the caret, underlined to mark it as uncommitted, and tell the engine where that caret is so the candidate window can follow it. A single-line field selects all of its text when focused; collapse that to the end of the selection once composing starts, since that is where the text will be inserted and where the candidate window belongs.
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.
Description of the problem being solved
Text an input method is still composing is invisible until it is committed, so typing through an IME looks like nothing is happening — no characters, no underline, and the candidate window has no caret to attach itself to. This affects anyone typing Chinese, Japanese or Korean into a build name, note or search field.
This is the application half of the work; the engine half is being submitted to the macOS engine port separately. Related: #5632.
Description of the changes
OnPreeditcallback and hold it onmain. It is state rather than an input event, since it is replaced wholesale on every keystroke and discarded when composing ends.EditControl.Everything is guarded:
SetIMECaretRectis only called if the running engine provides it, andmain.imePreeditis nil unless the engine sends a composition. On an engine without IME support this changes nothing.Steps taken to verify a working solution
Tested on macOS with the system Bopomofo input method and a third-party one: