diff options
Diffstat (limited to 'lib/readline.js')
-rw-r--r-- | lib/readline.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/readline.js b/lib/readline.js index f7591b7cc1..e45fb2938e 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -41,6 +41,7 @@ function Interface(input, output, completer, terminal) { this._sawReturn = false; this.isCompletionEnabled = true; + this._sawKeyPress = false; this._previousKey = null; EventEmitter.call(this); @@ -247,6 +248,9 @@ Interface.prototype._addHistory = function() { // if the history is disabled then return the line if (this.historySize === 0) return this.line; + // if the trimmed line is empty then return the line + if (this.line.trim().length === 0) return this.line; + if (this.history.length === 0 || this.history[0] !== this.line) { this.history.unshift(this.line); @@ -947,6 +951,10 @@ function emitKeypressEvents(stream, iface) { if (r) { clearTimeout(timeoutId); + if (iface) { + iface._sawKeyPress = r.length === 1; + } + for (var i = 0; i < r.length; i++) { if (r[i] === '\t' && typeof r[i + 1] === 'string' && iface) { iface.isCompletionEnabled = false; |