| 28 | * Clear ENABLE_PROCESSED_INPUT on the console stdin handle. |
| 29 | */ |
| 30 | export function win32DisableProcessedInput() { |
| 31 | if (process.platform !== "win32") return |
| 32 | if (!process.stdin.isTTY) return |
| 33 | if (!load()) return |
| 34 | |
| 35 | const handle = k32!.symbols.GetStdHandle(STD_INPUT_HANDLE) |
| 36 | const buf = new Uint32Array(1) |
| 37 | if (k32!.symbols.GetConsoleMode(handle, ptr(buf)) === 0) return |
| 38 | |
| 39 | const mode = buf[0]! |
| 40 | if ((mode & ENABLE_PROCESSED_INPUT) === 0) return |
| 41 | k32!.symbols.SetConsoleMode(handle, mode & ~ENABLE_PROCESSED_INPUT) |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Discard any queued console input (mouse events, key presses, etc.). |