From 2699f89643c7643f5711140365ed2b2ad44a1f5c Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 13 May 2020 16:58:29 -0500 Subject: [PATCH] Make conpty request win32-input-mode on startup --- src/host/VtIo.cpp | 2 ++ src/renderer/vt/VtSequences.cpp | 11 +++++++++++ src/renderer/vt/state.cpp | 13 +++++++++++++ src/renderer/vt/vtrenderer.hpp | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/src/host/VtIo.cpp b/src/host/VtIo.cpp index 09b3af630bd..d4b31ce9909 100644 --- a/src/host/VtIo.cpp +++ b/src/host/VtIo.cpp @@ -237,6 +237,8 @@ bool VtIo::IsUsingVt() const CATCH_RETURN(); } + 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 diff --git a/src/renderer/vt/VtSequences.cpp b/src/renderer/vt/VtSequences.cpp index 0b9c7baaf84..c94f4842b47 100644 --- a/src/renderer/vt/VtSequences.cpp +++ b/src/renderer/vt/VtSequences.cpp @@ -436,3 +436,14 @@ using namespace Microsoft::Console::Render; { return _Write("\x1b[29m"); } + +// Method Description: +// - TODO +// Arguments: +// - +// Return Value: +// - S_OK if we succeeded, else an appropriate HRESULT for failing to allocate or write. +[[nodiscard]] HRESULT VtEngine::_RequestWin32Input() noexcept +{ + return _Write("\x1b]1000;1;1\x07"); +} diff --git a/src/renderer/vt/state.cpp b/src/renderer/vt/state.cpp index 099fa487758..7fa21c56a8a 100644 --- a/src/renderer/vt/state.cpp +++ b/src/renderer/vt/state.cpp @@ -509,3 +509,16 @@ void VtEngine::SetResizeQuirk(const bool resizeQuirk) { return S_OK; } + +// Method Description: +// - TODO +// Arguments: +// - +// Return Value: +// - S_OK if we succeeded, else an appropriate HRESULT for failing to allocate or write. +HRESULT VtEngine::RequestWin32Input() noexcept +{ + RETURN_IF_FAILED(_RequestWin32Input()); + RETURN_IF_FAILED(_Flush()); + return S_OK; +} diff --git a/src/renderer/vt/vtrenderer.hpp b/src/renderer/vt/vtrenderer.hpp index 5f683bc9b15..3165263fc8f 100644 --- a/src/renderer/vt/vtrenderer.hpp +++ b/src/renderer/vt/vtrenderer.hpp @@ -110,6 +110,8 @@ namespace Microsoft::Console::Render [[nodiscard]] virtual HRESULT ManuallyClearScrollback() noexcept; + [[nodiscard]] HRESULT RequestWin32Input() noexcept; + protected: wil::unique_hfile _hFile; std::string _buffer; @@ -208,6 +210,8 @@ namespace Microsoft::Console::Render [[nodiscard]] HRESULT _RequestCursor() noexcept; + [[nodiscard]] HRESULT _RequestWin32Input() noexcept; + [[nodiscard]] virtual HRESULT _MoveCursor(const COORD coord) noexcept = 0; [[nodiscard]] HRESULT _RgbUpdateDrawingBrushes(const COLORREF colorForeground, const COLORREF colorBackground,