From b96df701744e1e6ca46cc5f4da3a96685b277612 Mon Sep 17 00:00:00 2001 From: Hamayama Date: Tue, 3 Nov 2020 17:50:55 +0900 Subject: [PATCH] Workaround for resizing window problem on Windows 10 --- src/agent/Scraper.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/agent/Scraper.cc b/src/agent/Scraper.cc index 21f9c671..088a510f 100755 --- a/src/agent/Scraper.cc +++ b/src/agent/Scraper.cc @@ -271,7 +271,18 @@ void Scraper::resizeImpl(const ConsoleScreenBufferInfo &origInfo) { // Resize the buffer to the final desired size. m_console.setFrozen(false); + + // Workaround for the windows console crash if resizing screen so that + // the cursor is hidden on Windows 10. + // ( https://github.com/microsoft/terminal/issues/1976 ) + const auto info = m_consoleBuffer->bufferInfo(); + m_consoleBuffer->setCursorPosition(Coord(0, 0)); + m_consoleBuffer->resizeBufferRange(finalBufferSize); + + // Restore cursor position from the above workaround. + m_consoleBuffer->setCursorPosition(Coord(info.cursorPosition().X, + info.cursorPosition().Y)); } {