mirror of
https://github.com/reactos/reactos.git
synced 2026-06-09 09:23:04 +08:00
[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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user