From ef83aa3c41d074ca24a3086888196fc145c57989 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Fri, 18 Sep 2020 12:25:39 -0700 Subject: [PATCH] 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 #6207. Fixes MSFT:29219348 --- .github/actions/spell-check/expect/expect.txt | 2 ++ src/host/conimeinfo.cpp | 4 ++++ src/host/convarea.cpp | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/actions/spell-check/expect/expect.txt b/.github/actions/spell-check/expect/expect.txt index d755991d8..be725a8f1 100644 --- a/.github/actions/spell-check/expect/expect.txt +++ b/.github/actions/spell-check/expect/expect.txt @@ -2715,6 +2715,7 @@ WNDCLASSW Wndproc WNegative WNull +wnwb workarea workaround workflow @@ -2762,6 +2763,7 @@ wtof wtoi wtw wtypes +Wubi WUX WVerify wwaproj diff --git a/src/host/conimeinfo.cpp b/src/host/conimeinfo.cpp index 5a9012d2a..86662775a 100644 --- a/src/host/conimeinfo.cpp +++ b/src/host/conimeinfo.cpp @@ -62,6 +62,10 @@ void ConsoleImeInfo::WriteCompMessage(const std::wstring_view text, { ClearAllAreas(); + // MSFT:29219348 only hide the cursor after the IME produces a string. + // See notes in convarea.cpp ImeStartComposition(). + SaveCursorVisibility(); + // Save copies of the composition message in case we need to redraw it as things scroll/resize _text = text; _attributes.assign(attributes.begin(), attributes.end()); diff --git a/src/host/convarea.cpp b/src/host/convarea.cpp index 98546d8ba..74d686326 100644 --- a/src/host/convarea.cpp +++ b/src/host/convarea.cpp @@ -104,8 +104,11 @@ void WriteConvRegionToScreen(const SCREEN_INFORMATION& ScreenInfo, gci.LockConsole(); auto unlock = wil::scope_exit([&] { gci.UnlockConsole(); }); - ConsoleImeInfo* const pIme = &gci.ConsoleIme; - pIme->SaveCursorVisibility(); + // 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. + // One such IME is WNWB's "Universal Wubi input method" from wnwb.com (v. 10+). + // We shouldn't hide the cursor here so as to not break those IMEs. gci.pInputBuffer->fInComposition = true; return S_OK;