-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As of 0315283, the libuv `UV_TTY_MODE_RAW_VT` flag is available for applications on Windows in order to have the terminal itself translate keypresses into control sequences, rather than libuv. This aligns the TTY setup more closely with POSIX platforms, and enables handling of control sequences in applications which libuv is not able to emit at all. Since the Node.js `readline` implementation already handles divergences between different control character sequences for the same keypresses (e.g. `<ESC>[[A` vs `<ESC>OP` for the F1 key), this should not present a visible change for typical Node.js TTY applications. Testing is handled on the libuv side, and not easily feasible with Node.js’s current TTY test setup.
cjihrig
approved these changes
May 16, 2025
juanarbol
approved these changes
May 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #58358 +/- ##
=======================================
Coverage 90.23% 90.23%
=======================================
Files 633 633
Lines 186847 186849 +2
Branches 36685 36680 -5
=======================================
+ Hits 168594 168599 +5
- Misses 11041 11044 +3
+ Partials 7212 7206 -6
🚀 New features to boost your workflow:
|
lpinca
approved these changes
May 16, 2025
legendecas
approved these changes
May 18, 2025
Landed in db2aae8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
c++
Issues and PRs that require attention from people who are familiar with C++.
needs-ci
PRs that need a full CI run.
tty
Issues and PRs related to the tty subsystem.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As of 0315283, the libuv
UV_TTY_MODE_RAW_VT
flag is available for applications on Windows in order to have the terminal itself translate keypresses into control sequences, rather than libuv. This aligns the TTY setup more closely with POSIX platforms, and enables handling of control sequences in applications which libuv is not able to emit at all.Since the Node.js
readline
implementation already handles divergences between different control character sequences for the same keypresses (e.g.<ESC>[[A
vs<ESC>OP
for the F1 key), this should not present a visible change for typical Node.js TTY applications.Testing is handled on the libuv side, and not easily feasible with Node.js’s current TTY test setup.