diff --git a/src/host/inputBuffer.cpp b/src/host/inputBuffer.cpp index edb7d51dec1a..a794d9bf6178 100644 --- a/src/host/inputBuffer.cpp +++ b/src/host/inputBuffer.cpp @@ -466,6 +466,8 @@ size_t InputBuffer::Prepend(_Inout_ std::deque>& in { try { + _vtInputShouldSuppress = true; + auto resetVtInputSupress = wil::scope_exit([&]() { _vtInputShouldSuppress = false; }); _HandleConsoleSuspensionEvents(inEvents); if (inEvents.empty()) { @@ -556,6 +558,8 @@ size_t InputBuffer::Write(_Inout_ std::deque>& inEv { try { + _vtInputShouldSuppress = true; + auto resetVtInputSuppress = wil::scope_exit([&]() { _vtInputShouldSuppress = false; }); _HandleConsoleSuspensionEvents(inEvents); if (inEvents.empty()) { @@ -841,8 +845,7 @@ bool InputBuffer::IsInVirtualTerminalInputMode() const // - Handler for inserting key sequences into the buffer when the terminal emulation layer // has determined a key can be converted appropriately into a sequence of inputs // Arguments: -// - rgInput - Series of input records to insert into the buffer -// - cInput - Length of input records array +// - inEvents - Series of input records to insert into the buffer // Return Value: // - void InputBuffer::_HandleTerminalInputCallback(std::deque>& inEvents) @@ -856,6 +859,12 @@ void InputBuffer::_HandleTerminalInputCallback(std::deque _writePartialByteSequence; Microsoft::Console::VirtualTerminal::TerminalInput _termInput; + // This flag is used in _HandleTerminalInputCallback + // If the InputBuffer leads to a _HandleTerminalInputCallback call, + // we should suppress the wakeup functions. + // Otherwise, we should be calling them. + bool _vtInputShouldSuppress{ false }; + void _ReadBuffer(_Out_ std::deque>& outEvents, const size_t readCount, _Out_ size_t& eventsRead,