Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken Chinese IME when deleting composition #5109

Merged
2 commits merged into from
Mar 25, 2020
Merged

Conversation

leonMSFT
Copy link
Contributor

@leonMSFT leonMSFT commented Mar 24, 2020

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

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.

@DHowett-MSFT DHowett-MSFT added the AutoMerge Marked for automatic merge by the bot when requirements are met label Mar 24, 2020
@ghost
Copy link

ghost commented Mar 24, 2020

Hello @DHowett-MSFT!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 4 hours 59 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@DHowett-MSFT
Copy link
Contributor

@msftbot merge this in 8 minutes

@ghost
Copy link

ghost commented Mar 24, 2020

Hello @DHowett-MSFT!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Tue, 24 Mar 2020 23:59:56 GMT, which is in 8 minutes

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@ghost ghost merged commit 1e30b53 into master Mar 25, 2020
@ghost ghost deleted the dev/lelian/imeweird branch March 25, 2020 00:00
@ghost
Copy link

ghost commented Apr 22, 2020

🎉Windows Terminal Preview v0.11.1121.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IME fails very frequently in the v0.10 release
4 participants