[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
This commit is contained in:
Hermès Bélusca-Maïto 2023-11-16 21:48:51 +01:00
parent a5c3bb5bce
commit 98353cdb37
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -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;
}
}