fix self-recover prompting on windows

the prompting on Windows wasn't working correctly if a prior game had crashed
and the self-recover feature was trying to kick in. This impacts tty, curses,
and mswin (GUI).
This commit is contained in:
nhmall
2019-12-03 23:32:12 -05:00
parent 8a7ec78d17
commit 5c57804a97
6 changed files with 216 additions and 64 deletions
+26 -2
View File
@@ -680,13 +680,37 @@ cl_end()
void
raw_clear_screen()
{
buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0);
if (WINDOWPORT("tty")) {
cell_t * back = console.back_buffer;
cell_t * front = console.front_buffer;
COORD pos;
DWORD unused;
for (pos.Y = 0; pos.Y < console.height; pos.Y++) {
for (pos.X = 0; pos.X < console.width; pos.X++) {
WriteConsoleOutputAttribute(console.hConOut, &back->attribute,
1, pos, &unused);
front->attribute = back->attribute;
if (console.has_unicode) {
WriteConsoleOutputCharacterW(console.hConOut,
&back->character, 1, pos, &unused);
} else {
char ch = (char)back->character;
WriteConsoleOutputCharacterA(console.hConOut, &ch, 1, pos,
&unused);
}
*front = *back;
back++;
front++;
}
}
}
}
void
clear_screen()
{
raw_clear_screen();
buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0);
home();
}