From 98353cdb376fa507b9201982ed956092149de363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Thu, 16 Nov 2023 21:48:51 +0100 Subject: [PATCH] [CMD] Use correct console input mode in ConInString() ENABLE_PROCESSED_INPUT is necessary to correctly deal with CR-LF and display it only when necessary. Fixes cmd:batch winetests. Addendum to commit db219e45c --- base/shell/cmd/console.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/base/shell/cmd/console.c b/base/shell/cmd/console.c index ba718fbc076..de35fa7f373 100644 --- a/base/shell/cmd/console.c +++ b/base/shell/cmd/console.c @@ -96,7 +96,7 @@ VOID ConInString(LPTSTR lpInput, DWORD dwLength) hFile = GetStdHandle(STD_INPUT_HANDLE); GetConsoleMode(hFile, &dwOldMode); - SetConsoleMode(hFile, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT); + SetConsoleMode(hFile, ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT); ReadFile(hFile, (PVOID)pBuf, dwLength - 1, &dwRead, NULL); @@ -106,10 +106,9 @@ VOID ConInString(LPTSTR lpInput, DWORD dwLength) #endif for (p = lpInput; *p; p++) { - if (*p == _T('\r')) // Terminate at the next carriage-return. + if (*p == _T('\r')) // Terminate at the carriage-return. { *p = _T('\0'); - ConOutChar(_T('\n')); // Output newline as well. break; } }