conpty: request DSR-CPR before Win32 input mode (#16445)

This prevents an issue in conhost where older versions of Windows
Terminal (including the ones currently inbox in Windows, as well as
stable and preview) will *still* cause WSL interop to hang on startup.

Since VT input is erroneously re-encoded as Win32 input events on those
versions, we need to make sure we request the cursor position *before*
enabling Win32 input mode. That way, the CPR we get back is properly
encoded.

(cherry picked from commit 17867af534)
Service-Card-Id: 91301135
Service-Version: 1.19
This commit is contained in:
Dustin L. Howett
2023-12-08 15:01:55 -06:00
committed by Dustin L. Howett
parent f63e25b87c
commit bcc01d96bf

View File

@@ -263,12 +263,6 @@ bool VtIo::IsUsingVt() const
CATCH_RETURN();
}
// GH#4999 - Send a sequence to the connected terminal to request
// win32-input-mode from them. This will enable the connected terminal to
// send us full INPUT_RECORDs as input. If the terminal doesn't understand
// this sequence, it'll just ignore it.
LOG_IF_FAILED(_pVtRenderEngine->RequestWin32Input());
// MSFT: 15813316
// If the terminal application wants us to inherit the cursor position,
// we're going to emit a VT sequence to ask for the cursor position, then
@@ -287,6 +281,12 @@ bool VtIo::IsUsingVt() const
}
}
// GH#4999 - Send a sequence to the connected terminal to request
// win32-input-mode from them. This will enable the connected terminal to
// send us full INPUT_RECORDs as input. If the terminal doesn't understand
// this sequence, it'll just ignore it.
LOG_IF_FAILED(_pVtRenderEngine->RequestWin32Input());
if (_pVtInputThread)
{
LOG_IF_FAILED(_pVtInputThread->Start());