From 87a3ddc0620fb3ff022663bf2241b92b483e3cf0 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 22 Oct 2023 12:42:50 +0100 Subject: win32: avoid terminal weirdness induced by Gradle? GitHub issue #372 reports that in certain circumstances (which I've been unable to reproduce) Gradle leaves the terminal in a state where linefeeds seem not to result in a carriage return. This *might* be because Gradle sets DISABLE_NEWLINE_AUTO_RETURN in the terminal mode. Reset DISABLE_NEWLINE_AUTO_RETURN to zero before the shell prompt is issued to see of this makes any difference. Costs 16-32 bytes. --- win32/winansi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win32/winansi.c b/win32/winansi.c index b5111603c..20a8cc210 100644 --- a/win32/winansi.c +++ b/win32/winansi.c @@ -121,6 +121,8 @@ 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; -- cgit v1.2.3-55-g6feb