Fix issue related to Windows 11 PowerShell console mode persistence

This commit is contained in:
Danny Daemonic 2023-08-04 21:27:51 -07:00
parent 332311234a
commit c760fd2452

View file

@ -80,8 +80,10 @@ namespace console {
// Set console input codepage to UTF16 // Set console input codepage to UTF16
_setmode(_fileno(stdin), _O_WTEXT); _setmode(_fileno(stdin), _O_WTEXT);
if (!simple_io) { // Set ICANON (ENABLE_LINE_INPUT) and ECHO (ENABLE_ECHO_INPUT)
// Turn off ICANON (ENABLE_LINE_INPUT) and ECHO (ENABLE_ECHO_INPUT) if (simple_io) {
dwMode |= ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT;
} else {
dwMode &= ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT); dwMode &= ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
} }
if (!SetConsoleMode(hConIn, dwMode)) { if (!SetConsoleMode(hConIn, dwMode)) {