From 13e660888f62113fd34cc559639c624af640cf0b Mon Sep 17 00:00:00 2001 From: vsemozhetbyt Date: Tue, 26 Apr 2016 16:21:21 +0300 Subject: [PATCH] doc: extra clarification of historySize option History caching in the `readline` io is active only for terminal interaction. Appropriate variables are initialized and relevant `_addHistory()` function is called only if exposed `terminal` option of `readline.createInterface()` is set `true` by user or internal output check. This clarification is useful to assure users there will be now wasted overhead connected with history caching if `readline` is used not for terminal interaction (e.g. for reading files line by line). Particularly this fix is helpful after #6352 landing. PR-URL: https://github.com/nodejs/node/pull/6397 Reviewed-By: James M Snell Reviewed-By: Alexander Makarenko Reviewed-By: Benjamin Gruenbaum --- doc/api/readline.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/readline.md b/doc/api/readline.md index f939368122d5b3..c75054dd2ee851 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -301,7 +301,9 @@ the following values: Defaults to checking `isTTY` on the `output` stream upon instantiation. - `historySize` - maximum number of history lines retained. To disable the - history set this value to `0`. Defaults to `30`. + history set this value to `0`. Defaults to `30`. This option makes sense + only if `terminal` is set to `true` by the user or by an internal `output` + check, otherwise the history caching mechanism is not initialized at all. The `completer` function is given the current line entered by the user, and is supposed to return an Array with 2 entries: