-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
doc: add some info on tty#setRawMode()
#10147
Conversation
@@ -50,6 +50,10 @@ raw device. Defaults to `false`. | |||
added: v0.7.7 | |||
--> | |||
|
|||
Allows configuration of `tty.ReadStream` so that it operates as a raw device. | |||
|
|||
For `stdin`, this mean that input is always available character-by-character (not including modifier characters such as `CTRL` or `ALT`). Additionally, all special processing of characters by the terminal is disabled, including echoing. (Such as when arrow keys or `CTRL`+`C` are pressed when running in default mode.) |
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.
Can you wrap at 80 characters.
490707d
to
6a63f9a
Compare
Allows configuration of `tty.ReadStream` so that it operates as a raw device. | ||
|
||
For `stdin`, this mean that input is always available character-by-character | ||
(not including modifier characters such as `CTRL` or `ALT`). Additionally, all |
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.
nit: I’d just call them “modifiers”, I don’t think they count as characters in any meaningful context
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.
You could probably just use a comma instead of parentheses.
@@ -50,6 +50,14 @@ raw device. Defaults to `false`. | |||
added: v0.7.7 | |||
--> | |||
|
|||
Allows configuration of `tty.ReadStream` so that it operates as a raw device. | |||
|
|||
For `stdin`, this mean that input is always available character-by-character |
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.
Why For `stdin`
? This applies to all tty.ReadStream
s equally
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.
mean -> means
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.
Well stdout doesn't usually receive this kind of input? Honestly I'm not really sure what this does to stdout...
|
||
For `stdin`, this mean that input is always available character-by-character | ||
(not including modifier characters such as `CTRL` or `ALT`). Additionally, all | ||
special processing of characters by the terminal is disabled, including echoing. |
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.
Maybe expand “echoing” to “echoing input characters” for clarity
For `stdin`, this mean that input is always available character-by-character | ||
(not including modifier characters such as `CTRL` or `ALT`). Additionally, all | ||
special processing of characters by the terminal is disabled, including echoing. | ||
(Such as when arrow keys or `CTRL`+`C` are pressed when running in default |
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.
I'm not sure the best way to improve it, but this sentence in parens looks off.
6a63f9a
to
4238eb7
Compare
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.
I still wonder why stdin
is being explicitly mentioned in the added text but other than that LGTM
4238eb7
to
b58aa76
Compare
@addaleax LGTY? |
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.
Yes, LGTM!
Partially taken from https://linux.die.net/man/3/cfmakeraw A very simple test script: ``` if (process.argv[2] === 'raw') process.stdin.setRawMode(true) process.stdin.on('data', (chunk) => { console.log(chunk) console.log(chunk.toString()) }) ``` Refs: nodejs#10037 PR-URL: nodejs#10147 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
b58aa76
to
a0a6ff2
Compare
Partially taken from https://linux.die.net/man/3/cfmakeraw A very simple test script: ``` if (process.argv[2] === 'raw') process.stdin.setRawMode(true) process.stdin.on('data', (chunk) => { console.log(chunk) console.log(chunk.toString()) }) ``` Refs: #10037 PR-URL: #10147 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Partially taken from https://linux.die.net/man/3/cfmakeraw A very simple test script: ``` if (process.argv[2] === 'raw') process.stdin.setRawMode(true) process.stdin.on('data', (chunk) => { console.log(chunk) console.log(chunk.toString()) }) ``` Refs: #10037 PR-URL: #10147 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Partially taken from https://linux.die.net/man/3/cfmakeraw A very simple test script: ``` if (process.argv[2] === 'raw') process.stdin.setRawMode(true) process.stdin.on('data', (chunk) => { console.log(chunk) console.log(chunk.toString()) }) ``` Refs: #10037 PR-URL: #10147 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Partially taken from https://linux.die.net/man/3/cfmakeraw A very simple test script: ``` if (process.argv[2] === 'raw') process.stdin.setRawMode(true) process.stdin.on('data', (chunk) => { console.log(chunk) console.log(chunk.toString()) }) ``` Refs: #10037 PR-URL: #10147 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Checklist
Affected core subsystem(s)
doc, tty
Description of change
Partially taken from https://linux.die.net/man/3/cfmakeraw
A very simple test script:
Related to #10037
Refs(?): http://docs.libuv.org/en/v1.x/tty.html#c.uv_tty_mode_t