Add IME support for CJK and other composed input - #3
Open
kychiou wants to merge 1 commit into
Open
Conversation
The embedded Terminal never enabled the OS IME for its window, so IME composition never engaged on any platform and only the raw ASCII fallback keystrokes (e.g. pinyin letters) reached the pty -- you could only type English. LineEdit/TextEdit avoid this by toggling window_set_ime_active on focus; the Terminal control never did. - Activate the OS IME while the terminal holds focus and deactivate on blur (sync_ime), mirroring LineEdit. Committed text then arrives as ordinary unicode key events, which encode_key already forwards, so no decoding changes are needed. - Track the cursor in control-local pixels and keep the IME candidate window positioned at it (refresh_ime_position). - Render the in-progress composition (preedit) inline over the grid at the cursor, underlined with a bar caret, from OS_IME_UPDATE via ime_get_text/ime_get_selection. The preedit is never sent to the pty; only the committed text is. Uses only the portable DisplayServer IME API and is guarded by has_feature(FEATURE_IME), so backends without IME (e.g. Wayland today) no-op cleanly. No platform-specific code. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
|
Thank you!, I'll review it over the next few days so we can add this functionality |
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.
The embedded Terminal never enabled the OS IME for its window, so IME composition never engaged on any platform and only the raw ASCII fallback keystrokes (e.g. pinyin letters) reached the pty -- you could only type English. LineEdit/TextEdit avoid this by toggling window_set_ime_active on focus; the Terminal control never did.
Uses only the portable DisplayServer IME API and is guarded by has_feature(FEATURE_IME), so backends without IME (e.g. Wayland today) no-op cleanly. No platform-specific code.