Skip to content

Commit 96e8afa

Browse files
committed
Fix Control+Space not sent to program running in terminal
1 parent d14524c commit 96e8afa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/host/inputBuffer.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,17 @@ void InputBuffer::_HandleTerminalInputCallback(const TerminalInput::StringType&
816816

817817
for (const auto& wch : text)
818818
{
819+
if (wch == UNICODE_NULL)
820+
{
821+
// Convert null byte back to input event with proper control state
822+
const auto zeroKey = OneCoreSafeVkKeyScanW(0);
823+
uint32_t ctrlState = 0;
824+
WI_SetFlagIf(ctrlState, SHIFT_PRESSED, WI_IsFlagSet(zeroKey, 0x100));
825+
WI_SetFlagIf(ctrlState, LEFT_CTRL_PRESSED, WI_IsFlagSet(zeroKey, 0x200));
826+
WI_SetFlagIf(ctrlState, LEFT_ALT_PRESSED, WI_IsFlagSet(zeroKey, 0x400));
827+
_storage.push_back(SynthesizeKeyEvent(true, 1, LOBYTE(zeroKey), 0, wch, ctrlState));
828+
continue;
829+
}
819830
_storage.push_back(SynthesizeKeyEvent(true, 1, 0, 0, wch, 0));
820831
}
821832

0 commit comments

Comments
 (0)