From: DannyDaemonic Date: Sun, 6 Aug 2023 06:49:34 +0000 (-0700) Subject: console : fix issue related to Windows 11 PowerShell console mode persistence (#2521) X-Git-Tag: gguf-v0.4.0~351 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=86c32198954a2bc482025703d6875e11f1c2a574;p=pkg%2Fggml%2Fsources%2Fllama.cpp console : fix issue related to Windows 11 PowerShell console mode persistence (#2521) --- diff --git a/examples/console.cpp b/examples/console.cpp index 4c32f3b0..8966b107 100644 --- a/examples/console.cpp +++ b/examples/console.cpp @@ -80,8 +80,10 @@ namespace console { // Set console input codepage to UTF16 _setmode(_fileno(stdin), _O_WTEXT); - if (!simple_io) { - // Turn off ICANON (ENABLE_LINE_INPUT) and ECHO (ENABLE_ECHO_INPUT) + // Set 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); } if (!SetConsoleMode(hConIn, dwMode)) {