From: nishi Date: Mon, 29 Jan 2024 03:25:51 +0000 (+0000) Subject: windows fix X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=959b906e7f58d044bf18c65a088e90bcfe34218a;p=libw3.git windows fix git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@131 d27a3e52-49c5-7645-884c-6793ebffc270 --- diff --git a/Example/w3b/w3b.c b/Example/w3b/w3b.c index b5cc32f..0ed391f 100644 --- a/Example/w3b/w3b.c +++ b/Example/w3b/w3b.c @@ -44,8 +44,8 @@ void get_terminal_size(int* width, int* height) { #ifdef __MINGW32__ CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo(winstdout, &csbi); - *width = csbi.dwSize.X; - *height = csbi.dwSize.Y; + *width = csbi.srWindow.Right - csbi.srWindow.Left + 1; + *height = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; #else struct winsize ws; ioctl(0, TIOCGWINSZ, &ws); @@ -261,6 +261,7 @@ void render_site() { char* seq = malloc(1024); sprintf(seq, "\x1b[1;%dH", termw - strlen(titlebuf != NULL ? titlebuf : "No title") - 1); #ifdef __MINGW32__ + DWORD written = 0; WriteConsole(winstdout, seq, strlen(seq), &written, NULL); #else printf("%s\x1b[7m %s \x1b[m", seq, titlebuf != NULL ? titlebuf : "No title");