From 035b860aa381a2d9f21f075240d317a4cb9c8c64 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 24 Oct 2023 08:43:50 +0100 Subject: win32: avoid terminal weirdness induced by Gradle Commit 87a3ddc06 (win32: avoid terminal weirdness induced by Gradle?) correctly diagnosed the problem but got the cure wrong. Reset DISABLE_NEWLINE_AUTO_RETURN in the new mode, not the old one. Otherwise the change isn't applied. Saves 48 bytes. (GitHub issue #372) --- win32/winansi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win32/winansi.c b/win32/winansi.c index 20a8cc210..ff4f4b118 100644 --- a/win32/winansi.c +++ b/win32/winansi.c @@ -121,10 +121,10 @@ int terminal_mode(int reset) if (is_console(STDOUT_FILENO)) { h = get_console(); if (GetConsoleMode(h, &oldmode)) { - // Turn off DISABLE_NEWLINE_AUTO_RETURN induced by Gradle? - oldmode &= ~DISABLE_NEWLINE_AUTO_RETURN; // Try to recover from mode 0 induced by SSH. newmode = oldmode == 0 ? 3 : oldmode; + // Turn off DISABLE_NEWLINE_AUTO_RETURN induced by Gradle? + newmode &= ~DISABLE_NEWLINE_AUTO_RETURN; if ((mode & VT_OUTPUT)) { newmode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; -- cgit v1.2.3-55-g6feb