Skip to content

Commit

Permalink
Merge branch 'elfmz:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-soft committed Jan 28, 2024
2 parents b0c7849 + 9a7fbdd commit e794ec6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions WinPort/src/ConsoleOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,13 @@ IConsoleOutput *ConsoleOutput::ForkConsoleOutput()
void ConsoleOutput::JoinConsoleOutput(IConsoleOutput *con_out)
{
ConsoleOutput *co = (ConsoleOutput *)con_out;
std::lock_guard<std::mutex> lock(_mutex);
unsigned int w = 0, h = 0;
_buf.GetSize(w, h);
CopyFrom(*co);
{
std::lock_guard<std::mutex> lock(_mutex);
_buf.GetSize(w, h);
CopyFrom(*co);
_buf.SetSize(w, h, _attributes);
}
if (_backend) {
SMALL_RECT screen_rect{0, 0, SHORT(w ? w - 1 : 0), SHORT(h ? h - 1 : 0)};
_backend->OnConsoleOutputUpdated(&screen_rect, 1);
Expand Down
9 changes: 6 additions & 3 deletions far2l/src/vt/vtshell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class VTShell : VTOutputReader::IProcessor, VTInputReader::IProcessor, IVTShell
void UpdateTerminalSize(int fd_term)
{
CONSOLE_SCREEN_BUFFER_INFO csbi = { };
if (WINPORT(GetConsoleScreenBufferInfo)( NULL, &csbi )
if (WINPORT(GetConsoleScreenBufferInfo)(ConsoleHandle(), &csbi )
&& csbi.dwSize.X && csbi.dwSize.Y) {
fprintf(stderr, "UpdateTerminalSize: %u x %u\n", csbi.dwSize.X, csbi.dwSize.Y);
struct winsize ws = {(unsigned short)csbi.dwSize.Y,
Expand Down Expand Up @@ -444,7 +444,7 @@ class VTShell : VTOutputReader::IProcessor, VTInputReader::IProcessor, IVTShell

if (!translated.empty()) {
if (_slavename.empty() && KeyEvent.uChar.UnicodeChar) {//pipes fallback
WINPORT(WriteConsole)( NULL, &KeyEvent.uChar.UnicodeChar, 1, &dw, NULL );
WINPORT(WriteConsole)(ConsoleHandle(), &KeyEvent.uChar.UnicodeChar, 1, &dw, NULL );
}
DbgPrintEscaped("INPUT", translated.c_str(), translated.size());
if (!WriteTerm(translated.c_str(), translated.size())) {
Expand Down Expand Up @@ -845,7 +845,7 @@ class VTShell : VTOutputReader::IProcessor, VTInputReader::IProcessor, IVTShell
{
if (_last_window_info_ir.EventType == WINDOW_BUFFER_SIZE_EVENT) {
DWORD dw = 0;
WINPORT(WriteConsoleInput)(NULL, &_last_window_info_ir, 1, &dw);
WINPORT(WriteConsoleInput)(ConsoleHandle(), &_last_window_info_ir, 1, &dw);
_last_window_info_ir.EventType = 0;
}
}
Expand Down Expand Up @@ -992,6 +992,7 @@ class VTShell : VTOutputReader::IProcessor, VTInputReader::IProcessor, IVTShell
StopIOReaders();
WINPORT(JoinConsole)(_console_handle);
_console_handle = NULL;
OnTerminalResized();

return ExecuteCommandCommonTail(true);
}
Expand All @@ -1011,9 +1012,11 @@ class VTShell : VTOutputReader::IProcessor, VTInputReader::IProcessor, IVTShell
FARString msg(Msg::CommandBackgrounded);
msg.Insert(0, L"\n");
msg.Append(L"\n");
const DWORD64 saved_color = GetColor();
SetColor(COL_HELPTOPIC, true);
DWORD dw;
WINPORT(WriteConsole)(NULL, msg.CPtr(), msg.GetLength(), &dw, NULL );
SetColor(saved_color, true);
StartIOReaders();
return false;
}
Expand Down

0 comments on commit e794ec6

Please sign in to comment.