[PR #4836] Allow Emoji composition to be seen in the TSF TextBlock #25978

Open
opened 2026-01-31 09:13:03 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/4836

State: closed
Merged: Yes


Summary of the Pull Request

Emoji composition was only being shown one letter at a time. This is because of the way I expected CoreTextTextUpdatingEventArgs.Range to be provided to TSFInputControl during composition (for Chinese/Japanese IME). Emoji IME composition gives the StartCaretPosition as the same as EndCaretPosition, unlike how for Chinese/Japanese IME, StartCaretPosition is usually the start of the composition and EndCaretPosition is the latest character in the composition. The solution is to change the _inputBuffer.substr() call to simply grab all of the buffer starting from _activeTextStart. This way I can ensure that I grab all of the "active text", instead of trusting the given args.Range to tell me the active text.

PR Checklist

Validation Steps Performed

Chinese, Japanese, Korean, Emoji composition performed. Emoji selection through pointer also performed.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/4836 **State:** closed **Merged:** Yes --- <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Emoji composition was only being shown one letter at a time. This is because of the way I expected `CoreTextTextUpdatingEventArgs.Range` to be provided to TSFInputControl during composition (for Chinese/Japanese IME). Emoji IME composition gives the `StartCaretPosition` as the same as `EndCaretPosition`, unlike how for Chinese/Japanese IME, `StartCaretPosition` is usually the start of the composition and `EndCaretPosition` is the latest character in the composition. The solution is to change the `_inputBuffer.substr()` call to simply grab all of the buffer starting from `_activeTextStart`. This way I can ensure that I grab all of the "active text", instead of trusting the given `args.Range` to tell me the active text. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #4828 * [x] CLA signed. * [x] Tests added/passed <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Chinese, Japanese, Korean, Emoji composition performed. Emoji selection through pointer also performed.
claunia added the pull-request label 2026-01-31 09:13:03 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25978