[PR #6207] [MERGED] Make sure cursor visibility is restored after using an IME #26592

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/6207
Author: @j4james
Created: 5/26/2020
Status: Merged
Merged: 5/27/2020
Merged by: @undefined

Base: masterHead: fix-ime-cursor


📝 Commits (1)

  • 3547689 Make sure cursor visibility is restored when the IME composition has ended.

📊 Changes

3 files changed (+11 additions, -9 deletions)

View changed files

📝 src/host/conimeinfo.cpp (+2 -7)
📝 src/host/conimeinfo.h (+3 -2)
📝 src/host/convarea.cpp (+6 -0)

📄 Description

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 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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/6207 **Author:** [@j4james](https://github.com/j4james) **Created:** 5/26/2020 **Status:** ✅ Merged **Merged:** 5/27/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `fix-ime-cursor` --- ### 📝 Commits (1) - [`3547689`](https://github.com/microsoft/terminal/commit/3547689b43ed54374e79720290ea11a3fe0a27ab) Make sure cursor visibility is restored when the IME composition has ended. ### 📊 Changes **3 files changed** (+11 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/host/conimeinfo.cpp` (+2 -7) 📝 `src/host/conimeinfo.h` (+3 -2) 📝 `src/host/convarea.cpp` (+6 -0) </details> ### 📄 Description ## 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 #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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:17:01 +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#26592