Skip to content

tty: use terminal VT mode on Windows #58358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/tty_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,17 @@ void TTYWrap::SetRawMode(const FunctionCallbackInfo<Value>& args) {
TTYWrap* wrap;
ASSIGN_OR_RETURN_UNWRAP(
&wrap, args.This(), args.GetReturnValue().Set(UV_EBADF));
int err = uv_tty_set_mode(&wrap->handle_, args[0]->IsTrue());
// UV_TTY_MODE_RAW_VT is a variant of UV_TTY_MODE_RAW that
// enables control sequence processing on the TTY implementer side,
// rather than having libuv translate keypress events into
// control sequences, aligning behavior more closely with
// POSIX platforms. This is also required to support some control
// sequences at all on Windows, such as bracketed paste mode.
// The Node.js readline implementation handles differences between
// these modes.
int err = uv_tty_set_mode(
&wrap->handle_,
args[0]->IsTrue() ? UV_TTY_MODE_RAW_VT : UV_TTY_MODE_NORMAL);
args.GetReturnValue().Set(err);
}

Expand Down
Loading