Skip to content
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: readline.emitKeypressEvents and raw mode #6628

Closed
wants to merge 1 commit into from

Conversation

arve0
Copy link
Contributor

@arve0 arve0 commented May 7, 2016

Checklist
  • documentation is changed or added
  • the commit message follows commit guidelines
Affected core subsystem(s)

doc

Description of change

readline.emitKeypressEvents needs stream to be in raw mode, fixes #6626

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label May 7, 2016
@addaleax addaleax added the readline Issues and PRs related to the built-in readline module. label May 7, 2016
@arve0 arve0 changed the title expand documentation for readline.emitKeypressEvents doc: readline.emitKeypressEvents and raw mode May 7, 2016
@@ -362,6 +362,12 @@ Move cursor to the specified position in a given TTY stream.
Causes `stream` to begin emitting `'keypress'` events corresponding to its
input.

Note that the stream need to be in raw mode:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@jasnell
Copy link
Member

jasnell commented May 8, 2016

@nodejs/documentation

@arve0
Copy link
Contributor Author

arve0 commented May 8, 2016

Might wanna add a check that the stream is a TTY in the example?

if (process.stdin.isTTY) {
    // might not be a TTY if spawned from another node process
    process.stdin.setRawMode(true)
}

@@ -362,6 +362,12 @@ Move cursor to the specified position in a given TTY stream.
Causes `stream` to begin emitting `'keypress'` events corresponding to its
input.

Note that the stream needs to be in raw mode:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“… the stream, if it is a TTY, needs to be…”?

@addaleax
Copy link
Member

@arve0 +1 to adding that check to the example. LGTM apart from that.

`readline.emitKeypressEvents` needs `stream` to be in raw mode, ref nodejs#6626
@arve0
Copy link
Contributor Author

arve0 commented May 12, 2016

Updated.

@r-52
Copy link
Contributor

r-52 commented May 12, 2016

LGTM

addaleax pushed a commit that referenced this pull request May 16, 2016
`readline.emitKeypressEvents` needs `stream` to be in raw mode.

PR-URL: #6628
Fixes: #6626
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Roman Klauke <[email protected]>
@addaleax
Copy link
Member

Landed in 1ba5a56. Thank you!

@addaleax addaleax closed this May 16, 2016
evanlucas pushed a commit that referenced this pull request May 17, 2016
`readline.emitKeypressEvents` needs `stream` to be in raw mode.

PR-URL: #6628
Fixes: #6626
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Roman Klauke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. readline Issues and PRs related to the built-in readline module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document that readline.emitKeypressEvents only works when tty is in raw mode
7 participants