diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index 4907d8394c7..37c58cf0cb7 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -116,7 +116,17 @@ void TTYWrap::SetRawMode(const FunctionCallbackInfo& 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); }