diff options
author | Arve Seljebu <arve.seljebu@gmail.com> | 2016-05-07 09:53:05 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-05-16 16:01:57 +0200 |
commit | 1ba5a56f492b184b71964bd5dd42cc4266d6627e (patch) | |
tree | 157af0e22f49bdb06ed157c207640361f6d04412 /doc/api/readline.md | |
parent | 9c33e0ebe7088511d7761c779dddf7e655416a55 (diff) | |
download | node-new-1ba5a56f492b184b71964bd5dd42cc4266d6627e.tar.gz |
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>
Diffstat (limited to 'doc/api/readline.md')
-rw-r--r-- | doc/api/readline.md | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/api/readline.md b/doc/api/readline.md index a9478ac0b8..cc71b20bc9 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -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. |