From b5b266c38ce8a3ecf0dbbc24f9b9810771b5dba9 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Thu, 23 Apr 2020 20:00:29 +0300 Subject: 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. --- osdep/terminal-win.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'osdep') diff --git a/osdep/terminal-win.c b/osdep/terminal-win.c index f5b66080ca..27740f9be3 100644 --- a/osdep/terminal-win.c +++ b/osdep/terminal-win.c @@ -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; } } -- cgit v1.2.3