Skip to content

Commit

Permalink
Merged PR 5193876: Don't hide the cursor until IME starts (ef83aa3)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DHowett committed Sep 18, 2020
2 parents a13a7c3 + ef83aa3 commit d1b8d60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/actions/spell-check/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,7 @@ WNDCLASSW
Wndproc
WNegative
WNull
wnwb
workarea
workaround
workflow
Expand Down Expand Up @@ -2762,6 +2763,7 @@ wtof
wtoi
wtw
wtypes
Wubi
WUX
WVerify
wwaproj
Expand Down
4 changes: 4 additions & 0 deletions src/host/conimeinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
7 changes: 5 additions & 2 deletions src/host/convarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d1b8d60

Please sign in to comment.