Skip to content

Commit

Permalink
really fix windows console
Browse files Browse the repository at this point in the history
  • Loading branch information
ab9rf committed Feb 18, 2025
1 parent d7100be commit cb7b4cd
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 cb7b4cd

Please sign in to comment.