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
This commit is contained in:
Dustin L. Howett 2020-09-18 12:25:39 -07:00 committed by GitHub
parent 468c8c6728
commit ef83aa3c41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View file

@ -2715,6 +2715,7 @@ WNDCLASSW
Wndproc
WNegative
WNull
wnwb
workarea
workaround
workflow
@ -2762,6 +2763,7 @@ wtof
wtoi
wtw
wtypes
Wubi
WUX
WVerify
wwaproj

View file

@ -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());

View file

@ -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;