aboutsummaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2025-02-21 23:34:53 +0100
committerGitHub <noreply@github.com>2025-02-21 23:34:53 +0100
commit843b64faf5fbbd19c04475bafa38c0c91514efb8 (patch)
treecd3986580e5e2b6c1034d53395b11f102cc33b24 /docs/src
parent85b526f56ac0ca5e76de5cbc0e1e9452f73a01d5 (diff)
downloadlibuv-843b64faf5fbbd19c04475bafa38c0c91514efb8.tar.gz
libuv-843b64faf5fbbd19c04475bafa38c0c91514efb8.zip
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. https://github.com/PowerShell/PowerShell/blob/4e7942135f998ab40fd3ae298b020e161a76d4ef/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: https://github.com/nodejs/node/commit/87af913b66eab78088acfd7f3b57d35e22c5f1ba Refs: https://github.com/microsoft/terminal/issues/4954
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/tty.rst9
1 files changed, 7 insertions, 2 deletions
diff --git a/docs/src/tty.rst b/docs/src/tty.rst
index 7a223521..b461b244 100644
--- a/docs/src/tty.rst
+++ b/docs/src/tty.rst
@@ -27,10 +27,15 @@ Data types
typedef enum {
/* Initial/normal terminal mode */
UV_TTY_MODE_NORMAL,
- /* Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled) */
+ /*
+ * Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled).
+ * May become equivalent to UV_TTY_MODE_RAW_VT in future libuv versions.
+ */
UV_TTY_MODE_RAW,
/* Binary-safe I/O mode for IPC (Unix-only) */
- UV_TTY_MODE_IO
+ UV_TTY_MODE_IO,
+ /* Raw input mode. On Windows ENABLE_VIRTUAL_TERMINAL_INPUT is also set. */
+ UV_TTY_MODE_RAW_VT
} uv_tty_mode_t;
.. c:enum:: uv_tty_vtermstate_t