Skip to content

Commit

Permalink
TTY|F: fix clipboard access dialog missing repaints (fix #2634)
Browse files Browse the repository at this point in the history
  • Loading branch information
elfmz committed Feb 15, 2025
1 parent 2455aab commit 139746e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion far2l/src/vt/vtansi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ [email protected]

#include <mutex>
#include <atomic>
#include <optional>
#include <map>
#include "vtansi.h"
#include "AnsiEsc.hpp"
Expand Down Expand Up @@ -1312,6 +1313,7 @@ struct VTAnsiContext
}

} else {
_crds.reset(); // prevent clipboard dialog miss repaints
vt_shell->OnApplicationProtocolCommand(os_cmd_arg.c_str());
}
}
Expand Down Expand Up @@ -1416,13 +1418,17 @@ struct VTAnsiContext
// the last arguments are processed (no es_argv[] overflow).
//-----------------------------------------------------------------------------

std::optional<ConsoleRepaintsDeferScope> _crds;

void ParseAndPrintString(
LPCVOID lpBuffer,
DWORD nNumberOfBytesToWrite)
{
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) {
Expand Down Expand Up @@ -1581,6 +1587,7 @@ struct VTAnsiContext
}
}
FlushBuffer();
_crds.reset();
ASSERT(i == 0);
}

Expand Down Expand Up @@ -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());
}

Expand Down

0 comments on commit 139746e

Please sign in to comment.