Skip to content

Commit

Permalink
doc: readline.emitKeypressEvents and raw mode
Browse files Browse the repository at this point in the history
`readline.emitKeypressEvents` needs `stream` to be in raw mode.

PR-URL: #6628
Fixes: #6626
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
  • Loading branch information
arve0 authored and addaleax committed May 16, 2016
1 parent 9c33e0e commit 1ba5a56
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,15 @@ input.
Optionally, `interface` specifies a `readline.Interface` instance for which
autocompletion is disabled when copy-pasted input is detected.

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.
Expand Down

0 comments on commit 1ba5a56

Please sign in to comment.