osdep/terminal-win: native VT: report exact width

The narrower-by-1 width is not required with a native VT console
because the wrapping behavior is the same as on *nix on such case.
This commit is contained in:
Avi Halachmi (:avih) 2020-04-23 20:00:29 +03:00 committed by Jan Ekström
parent ca531b1cb2
commit b5b266c38c
1 changed files with 3 additions and 2 deletions

View File

@ -99,8 +99,9 @@ static struct input_ctx *input_ctx;
void terminal_get_size(int *w, int *h)
{
CONSOLE_SCREEN_BUFFER_INFO cinfo;
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cinfo)) {
*w = cinfo.dwMaximumWindowSize.X - 1;
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (GetConsoleScreenBufferInfo(hOut, &cinfo)) {
*w = cinfo.dwMaximumWindowSize.X - (is_native_out_vt(hOut) ? 0 : 1);
*h = cinfo.dwMaximumWindowSize.Y;
}
}