windows: Erase pre-calc'd number of chars instead of clearing whole line.

This commit is contained in:
stijn 2015-10-26 11:49:48 +01:00 committed by Damien George
parent 393d0c1679
commit dc93f25bb8
1 changed files with 2 additions and 3 deletions

View File

@ -96,10 +96,9 @@ void mp_hal_erase_line_from_cursor(uint n_chars_to_erase) {
assure_conout_handle();
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(con_out, &info);
const short len = info.dwSize.X - info.dwCursorPosition.X;
DWORD written;
FillConsoleOutputCharacter(con_out, ' ', len, info.dwCursorPosition, &written);
FillConsoleOutputAttribute(con_out, info.wAttributes, len, info.dwCursorPosition, &written);
FillConsoleOutputCharacter(con_out, ' ', n_chars_to_erase, info.dwCursorPosition, &written);
FillConsoleOutputAttribute(con_out, info.wAttributes, n_chars_to_erase, info.dwCursorPosition, &written);
}
typedef struct item_t {