mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
doc: readline.emitKeypressEvents and raw mode
`readline.emitKeypressEvents` needs `stream` to be in raw mode. PR-URL: https://github.com/nodejs/node/pull/6628 Fixes: https://github.com/nodejs/node/issues/6626 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
This commit is contained in:
1 parent
1c7b6e276f
commit
2273971a69
1 file changed
+9
@@ -362,6 +362,15 @@ 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, if it is a TTY, needs to be in raw mode:
|
||||
```js
|
||||
readline.emitKeypressEvents(process.stdin);
|
||||
if (process.stdin.isTTY) {
|
||||
// might not be a TTY if spawned from another node process
|
||||
process.stdin.setRawMode(true);
|
||||
}
|
||||
```
|
||||
|
||||
## readline.moveCursor(stream, dx, dy)
|
||||
|
||||
Move cursor relative to it's current position in a given TTY stream.
|
||||
|
||||
Reference in new issue
Block a user