From bcc01d96bf856a043dfc792dad770c4e433fd93f Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Fri, 8 Dec 2023 15:01:55 -0600 Subject: [PATCH] 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 17867af5349a66fa8121d1c930dd9587e45f5117) Service-Card-Id: 91301135 Service-Version: 1.19 --- src/host/VtIo.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/host/VtIo.cpp b/src/host/VtIo.cpp index b0c3367172..f9a6b72276 100644 --- a/src/host/VtIo.cpp +++ b/src/host/VtIo.cpp @@ -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());