Skip to content

Commit 9bafa52

Browse files
authored
Fix alt-numpad events (#17635)
This fixes a regression caused by 5b44476 which accidentally moved the two pushes into the if condition. Closes MSFT:52463679 ## Validation Steps Performed * Enable `Feature_UseNumpadEventsForClipboardInput` * `cmd` * `chcp 54936` * Paste narrow Unicode characters like ① * It works ✅
1 parent 39108a7 commit 9bafa52

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/interactivity/base/EventSynthesis.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ void Microsoft::Console::Interactivity::SynthesizeNumpadEvents(const wchar_t wch
127127
char converted = 0;
128128
const auto result = WideCharToMultiByte(codepage, 0, &wch, 1, &converted, 1, nullptr, nullptr);
129129

130+
// alt keydown
131+
keyEvents.push_back(SynthesizeKeyEvent(true, 1, VK_MENU, altScanCode, 0, LEFT_ALT_PRESSED));
132+
130133
if (result == 1)
131134
{
132-
// alt keydown
133-
keyEvents.push_back(SynthesizeKeyEvent(true, 1, VK_MENU, altScanCode, 0, LEFT_ALT_PRESSED));
134-
135135
// It is OK if the char is "signed -1", we want to interpret that as "unsigned 255" for the
136136
// "integer to character" conversion below with ::to_string, thus the static_cast.
137137
// Prime example is nonbreaking space U+00A0 will convert to OEM by codepage 437 to 0xFF which is -1 signed.
@@ -149,8 +149,8 @@ void Microsoft::Console::Interactivity::SynthesizeNumpadEvents(const wchar_t wch
149149
keyEvent.Event.KeyEvent.bKeyDown = FALSE;
150150
keyEvents.push_back(keyEvent);
151151
}
152-
153-
// alt keyup
154-
keyEvents.push_back(SynthesizeKeyEvent(false, 1, VK_MENU, altScanCode, wch, 0));
155152
}
153+
154+
// alt keyup
155+
keyEvents.push_back(SynthesizeKeyEvent(false, 1, VK_MENU, altScanCode, wch, 0));
156156
}

0 commit comments

Comments
 (0)