Skip to content

Commit

Permalink
conpty: request DSR-CPR before Win32 input mode (#16445)
Browse files Browse the repository at this point in the history
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 17867af)
Service-Card-Id: 91301135
Service-Version: 1.19
  • Loading branch information
DHowett committed Dec 8, 2023
1 parent f63e25b commit bcc01d9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/host/VtIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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());
Expand Down

0 comments on commit bcc01d9

Please sign in to comment.