Skip to content

Commit 17867af

Browse files
authored
conpty: request DSR-CPR before Win32 input mode (microsoft#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.
1 parent 20dad62 commit 17867af

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/host/VtIo.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,6 @@ bool VtIo::IsUsingVt() const
263263
CATCH_RETURN();
264264
}
265265

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

284+
// GH#4999 - Send a sequence to the connected terminal to request
285+
// win32-input-mode from them. This will enable the connected terminal to
286+
// send us full INPUT_RECORDs as input. If the terminal doesn't understand
287+
// this sequence, it'll just ignore it.
288+
LOG_IF_FAILED(_pVtRenderEngine->RequestWin32Input());
289+
290290
if (_pVtInputThread)
291291
{
292292
LOG_IF_FAILED(_pVtInputThread->Start());

0 commit comments

Comments
 (0)