Skip to content

Commit

Permalink
Merge pull request #5282 from ab9rf/fix-win-console-hang
Browse files Browse the repository at this point in the history
really fix windows console
  • Loading branch information
myk002 authored Feb 19, 2025
2 parents ca3af5e + cb7b4cd commit ce325fe
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions library/Console-windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,16 @@ namespace DFHack
size_t len = raw_buffer.size();
int cooked_cursor = raw_cursor;

int adj = std::min(plen + cooked_cursor - cols, len);
buf += adj;
len -= adj;
cooked_cursor -= adj;
if (plen + cooked_cursor > cols)
{
int adj = std::min(plen + cooked_cursor - cols, len);
buf += adj;
len -= adj;
cooked_cursor -= adj;
}

int adj2 = std::min(plen + len - cols, len);
len -= adj2;
if (len + plen > cols)
len = cols - plen;

CONSOLE_SCREEN_BUFFER_INFO inf = { 0 };
GetConsoleScreenBufferInfo(console_out, &inf);
Expand Down

0 comments on commit ce325fe

Please sign in to comment.