libuv/src/win
Anna Henningsen 843b64faf5
win: add ENABLE_VIRTUAL_TERMINAL_INPUT raw tty mode (#4688)
Windows provides the `ENABLE_VIRTUAL_TERMINAL_INPUT` flag for TTY input
streams as a companion flag to `ENABLE_VIRTUAL_TERMINAL_PROCESSING`,
which libuv is already setting for TTY output streams.

Setting this flag lets the terminal emulator perform some of the
processing that libuv already currently does for input events,
but most notably enables receiving control sequences that are
otherwise entirely unavailable, e.g. for bracketed paste
(which the Node.js readline implementation added basic support for
in https://github.com/nodejs/node/commit/87af913b66eab78088acfd).

libuv currently already provides translations for key events to
control sequences, i.e. what this mode is intended to provide,
but libuv does not and cannot translate all such events.
Since the control sequences differ from the ones that Windows
has chosen to standardize on, and applications may not be expecting
this change, this is opt-in for now (but ideally will be the default
behavior starting in libuv v2.x, should that ever happen).

Another downside of this change is that not all shells reset
this mode when an application exits. For example, when running a
Node.js program with this flag enabled inside of PowerShell in
Windows terminal, if the application exits while in raw TTY input mode,
neither the shell nor the terminal emulator reset this flag, rendering
the input stream unusable.

While there's general awareness of the problem that console state is
global state rather than per-process (same as on UNIX platforms),
it seems that applications like PowerShell aren't expecting to need to
unset this flag on the input stream, only its output counterpart
(e.g. 4e7942135f/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs (L1156)).

Hence, `uv_tty_reset_mode()` is extended to reset the terminal
to its original state if the new mode is being used.

Refs: 87af913b66
Refs: https://github.com/microsoft/terminal/issues/4954
2025-02-21 23:34:53 +01:00
..
async.c win: fix style nits [NFC] (#3474) 2022-02-15 10:13:24 -05:00
atomicops-inl.h mingw: fix building for ARM/AArch64 2021-07-14 12:36:30 -04:00
core.c win: use GetQueuedCompletionStatusEx directly 2024-12-10 23:44:29 +01:00
detect-wakeup.c nfci: address some style nits 2020-08-21 17:25:42 -04:00
dl.c misc: export WTF8 conversion utilities (#4021) 2023-10-28 21:04:57 -04:00
error.c win: remap ERROR_NOACCESS and ERROR_BUFFER_OVERFLOW (#4567) 2024-10-17 15:37:00 -04:00
fs-event.c win: fix leak processing fs event 2024-12-16 13:58:43 +01:00
fs-fd-hash-inl.h nfci: address some style nits 2020-08-21 17:25:42 -04:00
fs.c unix,win: accept NAN/INFINITY as file timestamps (#4702) 2025-02-21 23:08:15 +01:00
getaddrinfo.c win: Fix linked list logic in getaddrinfo (#4578) 2024-10-17 15:36:07 -04:00
getnameinfo.c unix,win: remove unused req parameter from macros (#4435) 2024-07-11 21:29:15 +02:00
handle-inl.h unix,win: replace QUEUE with struct uv__queue (#4022) 2023-05-25 00:04:30 +02:00
handle.c win: fix style nits [NFC] (#3474) 2022-02-15 10:13:24 -05:00
internal.h win: fix WriteFile() error translation (#4562) 2024-10-03 18:53:39 +02:00
loop-watcher.c win: fix style nits [NFC] (#3474) 2022-02-15 10:13:24 -05:00
pipe.c unix,win: harmonize buffer checking 2024-11-25 15:10:47 +01:00
poll.c win: drop code checking for Windows XP / Server 2k3 2022-11-08 06:51:07 +01:00
process-stdio.c build: ubsan fixes (#4254) 2024-08-05 17:15:53 -04:00
process.c win: check cwd length before spawning a child process 2025-01-29 22:51:06 +01:00
req-inl.h build: ubsan fixes (#4254) 2024-08-05 17:15:53 -04:00
signal.c unix,win: remove unused rb-tree macro parameters (#4518) 2024-08-25 22:54:09 +02:00
snprintf.c win: fix compilation with VS < 2012 2015-10-01 00:41:41 +02:00
stream-inl.h win: fix style nits [NFC] (#3474) 2022-02-15 10:13:24 -05:00
stream.c win: fix WriteFile() error translation (#4562) 2024-10-03 18:53:39 +02:00
tcp.c unix,win: remove unused req parameter from macros (#4435) 2024-07-11 21:29:15 +02:00
thread.c win: lazy-load [GS]etThreadDescription symbols (#4679) 2025-01-24 21:53:22 +01:00
tty.c win: add ENABLE_VIRTUAL_TERMINAL_INPUT raw tty mode (#4688) 2025-02-21 23:34:53 +01:00
udp.c unix,win: add uv_udp_try_send2 2024-12-13 21:52:59 +01:00
util.c win: fix leak in uv_os_tmpdir 2025-01-24 11:46:16 +01:00
winapi.c win: use GetQueuedCompletionStatusEx directly 2024-12-10 23:44:29 +01:00
winapi.h win: fix order of FILE_STAT_BASIC_INFORMATION struct fields 2025-02-10 12:32:57 +01:00
winsock.c win: fix style nits [NFC] (#3474) 2022-02-15 10:13:24 -05:00
winsock.h win: drop support for the legacy MinGW (#4645) 2024-12-12 15:59:30 +01:00