]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
console : fix issue related to Windows 11 PowerShell console mode persistence (#2521)
authorDannyDaemonic <redacted>
Sun, 6 Aug 2023 06:49:34 +0000 (23:49 -0700)
committerGitHub <redacted>
Sun, 6 Aug 2023 06:49:34 +0000 (09:49 +0300)
examples/console.cpp

index 4c32f3b09c31d893df6181c1bd493f8e80ac1d66..8966b107f079790081ceaa7fa9786d81a9eec322 100644 (file)
@@ -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)) {