mirror of
https://github.com/microsoft/terminal.git
synced 2026-07-08 17:56:28 +00:00
Only honor Ctrl+Z during ReadFile if the console is in PROCESSED mode (#19940)
This restores the behavior of ReadFile to that of Windows 7.
Closes #4958
(cherry picked from commit 80e4b3c947)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpBM28
Service-Version: 1.25
This commit is contained in:
committed by
Dustin L. Howett
parent
e382d328b2
commit
2c9277cbb4
1
.github/actions/spelling/expect/expect.txt
vendored
1
.github/actions/spelling/expect/expect.txt
vendored
@@ -572,6 +572,7 @@ FGHIJ
|
||||
fgidx
|
||||
FGs
|
||||
FILEDESCRIPTION
|
||||
filehops
|
||||
FILESUBTYPE
|
||||
FILESYSPATH
|
||||
FILEW
|
||||
|
||||
@@ -670,7 +670,7 @@ void FileTests::TestReadFileBasicEmpty()
|
||||
const auto hIn = GetStdInputHandle();
|
||||
VERIFY_IS_NOT_NULL(hIn, L"Verify we have the standard input handle.");
|
||||
|
||||
DWORD dwMode = 0;
|
||||
DWORD dwMode = ENABLE_PROCESSED_INPUT; // ^Z is only handled when processed input is enabled.
|
||||
VERIFY_WIN32_BOOL_SUCCEEDED(SetConsoleMode(hIn, dwMode), L"Set input mode for test.");
|
||||
|
||||
VERIFY_WIN32_BOOL_SUCCEEDED(FlushConsoleInputBuffer(hIn), L"Flush input buffer in preparation for test.");
|
||||
|
||||
@@ -270,6 +270,16 @@ constexpr T saturate(auto val)
|
||||
}
|
||||
CATCH_RETURN();
|
||||
|
||||
if (a->ProcessControlZ)
|
||||
{
|
||||
// ProcessControlZ is only set for CONSOLE_IO_RAW_READ. To restore
|
||||
// the behavior from Windows 7 (see filehops.c:123) we need to honor
|
||||
// ^Z only if PROCESSED_INPUT is enabled.
|
||||
ULONG InputMode{ 0 };
|
||||
m->_pApiRoutines->GetConsoleInputModeImpl(*pInputBuffer, InputMode);
|
||||
a->ProcessControlZ = (InputMode & ENABLE_PROCESSED_INPUT) != 0;
|
||||
}
|
||||
|
||||
TraceConsoleAPICallWithOrigin(
|
||||
"ReadConsole",
|
||||
TraceLoggingBoolean(a->Unicode, "Unicode"),
|
||||
|
||||
Reference in New Issue
Block a user