Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix broken Chinese IME when deleting composition (#5109)
## Summary of the Pull Request This PR fixes an out of bounds access when deleting composition during Chinese IME. What's happening is that we're receiving a CompositionCompleted before receiving the TextUpdate to tell us to delete the last character in the composition. This creates two problems for us: 1. The final character gets sent to the Terminal when it should have been deleted. 2. `_activeTextStart` gets set to `_inputBuffer.length()` when sending the character to the terminal, so when the `TextUpdate` comes right after the `CompositionCompleted` event, `_activeTextStart` is out of sync. This PR fixes the second issue, by updating `_activeTextStart` during a `TextUpdate` in case we run into this issue. The first issue is trickier to resolve since we assume that if the text server api tells us a composition is completed, we should send what we have. It'll be tracked here: #5110. At the very least, this PR will let users continue to type in Chinese IME without it breaking, but it will still be annoying to see the first letter of your composition reappear after deleting it. ## PR Checklist * [x] Closes #5054 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed ## Validation Steps Performed Play around with Chinese IME deleting and composing, and play around with Korean and Japanese IME to see that it still works as expected.
- Loading branch information