-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Make sure cursor visibility is restored after using an IME #6207
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me, thanks!
Hello @carlos-zamora! Because this pull request has the 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 (
|
…#6207) ## Summary of the Pull Request When using an _Input Method Editor_ in conhost for East Asian languages, the text cursor is temporarily hidden while the characters are being composed. When the composition is complete, the cursor visibility is meant to be restored, but that doesn't always happen if the IME composition is cancelled. This PR makes sure the cursor visibility is always restored, regardless of how the IME is closed. ## PR Checklist * [x] Closes microsoft#810 * [x] CLA signed. * [ ] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. ## Detailed Description of the Pull Request / Additional comments The original implementation hid the cursor whenever `ConsoleImeInfo::WriteCompMessage` was called (which could be multiple times in the course of a composition), and then only restored the visibility when `ConsoleImeInfo::WriteResultMessage` was called. If a composition is cancelled, though, `WriteResultMessage` would never be called, so the cursor visibility wouldn't be restored. I've now made the `SaveCursorVisibility` and `RestoreCursorVisibility` methods public, so they can instead be called from the `ImeStartComposition` and `ImeEndComposition` functions. This makes sure `RestoreCursorVisibility` is always called, regardless of how the composition ended, and `SaveCursorVisibility` is only called once at the start of the composition (which isn't essential, but seems cleaner to me). ## Validation Steps Performed I've manually tested opening and closing the IME, both while submitting characters and while cancelling a composition, and in all cases the cursor visibility was correctly restored.
🎉 Handy links: |
🎉 Once again, thanks for the contribution! This pull request was included in a set of conhost changes that was just |
Some IME implementations do not produce composition strings, and their users have come to rely on the cursor that conhost traditionally left on until a composition string showed up. We shouldn't hide the cursor until we get a string (as opposed to hiding it when composition begins) so as to not break those IMEs. Related to #6207. Fixes MSFT:29219348
Some IME implementations do not produce composition strings, and their users have come to rely on the cursor that conhost traditionally left on until a composition string showed up. We shouldn't hide the cursor until we get a string (as opposed to hiding it when composition begins) so as to not break those IMEs. Related to #6207. Fixes MSFT:29219348 (cherry picked from commit ef83aa3)
Make sure we don't hide the cursor until the IME starts (#7673) Some IME implementations do not produce composition strings, and their users have come to rely on the cursor that conhost traditionally left on until a composition string showed up. We shouldn't hide the cursor until we get a string (as opposed to hiding it when composition begins) so as to not break those IMEs. Related to GH-6207. Fixes MSFT-29219348
Summary of the Pull Request
When using an Input Method Editor in conhost for East Asian languages, the text cursor is temporarily hidden while the characters are being composed. When the composition is complete, the cursor visibility is meant to be restored, but that doesn't always happen if the IME composition is cancelled. This PR makes sure the cursor visibility is always restored, regardless of how the IME is closed.
PR Checklist
Detailed Description of the Pull Request / Additional comments
The original implementation hid the cursor whenever
ConsoleImeInfo::WriteCompMessage
was called (which could be multiple times in the course of a composition), and then only restored the visibility whenConsoleImeInfo::WriteResultMessage
was called. If a composition is cancelled, though,WriteResultMessage
would never be called, so the cursor visibility wouldn't be restored.I've now made the
SaveCursorVisibility
andRestoreCursorVisibility
methods public, so they can instead be called from theImeStartComposition
andImeEndComposition
functions. This makes sureRestoreCursorVisibility
is always called, regardless of how the composition ended, andSaveCursorVisibility
is only called once at the start of the composition (which isn't essential, but seems cleaner to me).Validation Steps Performed
I've manually tested opening and closing the IME, both while submitting characters and while cancelling a composition, and in all cases the cursor visibility was correctly restored.