Skip to content

Commit b357de9

Browse files
authored
Fix cursor being hidden when pressing modifier keys (#19473)
Closes #19445
1 parent b8f35a3 commit b357de9

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/cascadia/WindowsTerminal/WindowEmperor.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,22 @@ static wil::unique_mutex acquireMutexOrAttemptHandoff(const wchar_t* className,
194194
return {};
195195
}
196196

197+
static constexpr bool IsInputKey(WORD vkey) noexcept
198+
{
199+
return vkey != VK_CONTROL &&
200+
vkey != VK_LCONTROL &&
201+
vkey != VK_RCONTROL &&
202+
vkey != VK_MENU &&
203+
vkey != VK_LMENU &&
204+
vkey != VK_RMENU &&
205+
vkey != VK_SHIFT &&
206+
vkey != VK_LSHIFT &&
207+
vkey != VK_RSHIFT &&
208+
vkey != VK_LWIN &&
209+
vkey != VK_RWIN &&
210+
vkey != VK_SNAPSHOT;
211+
}
212+
197213
HWND WindowEmperor::GetMainWindow() const noexcept
198214
{
199215
_assertIsMainThread();
@@ -486,7 +502,13 @@ void WindowEmperor::HandleCommandlineArgs(int nCmdShow)
486502

487503
if (msg.message == WM_KEYDOWN)
488504
{
489-
IslandWindow::HideCursor();
505+
const auto vkey = static_cast<WORD>(msg.wParam);
506+
507+
// Hide the cursor only when the key pressed is an input key (ignore modifier keys).
508+
if (IsInputKey(vkey))
509+
{
510+
IslandWindow::HideCursor();
511+
}
490512
}
491513
}
492514

0 commit comments

Comments
 (0)