diff --git a/far2l/src/vt/vtansi.cpp b/far2l/src/vt/vtansi.cpp index 3617ff2be0..f5e93e6ba6 100644 --- a/far2l/src/vt/vtansi.cpp +++ b/far2l/src/vt/vtansi.cpp @@ -168,6 +168,7 @@ jadoxa@yahoo.com.au #include #include +#include #include #include "vtansi.h" #include "AnsiEsc.hpp" @@ -1312,6 +1313,7 @@ struct VTAnsiContext } } else { + _crds.reset(); // prevent clipboard dialog miss repaints vt_shell->OnApplicationProtocolCommand(os_cmd_arg.c_str()); } } @@ -1416,6 +1418,8 @@ struct VTAnsiContext // the last arguments are processed (no es_argv[] overflow). //----------------------------------------------------------------------------- + std::optional _crds; + void ParseAndPrintString( LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite) @@ -1423,6 +1427,8 @@ struct VTAnsiContext DWORD i; LPCWSTR s; + _crds.emplace(vt_shell->ConsoleHandle()); + for (i = nNumberOfBytesToWrite, s = (LPCWSTR)lpBuffer; i > 0; i--, s++) { if (state == 1) { if (*s == ESC) { @@ -1581,6 +1587,7 @@ struct VTAnsiContext } } FlushBuffer(); + _crds.reset(); ASSERT(i == 0); } @@ -1723,7 +1730,6 @@ void VTAnsi::Write(const char *str, size_t len) --len; } - ConsoleRepaintsDeferScope crds(_ctx->vt_shell->ConsoleHandle()); _ctx->ParseAndPrintString(_ws.c_str(), _ws.size()); }