summaryrefslogtreecommitdiff
path: root/lib/readline.js
diff options
context:
space:
mode:
authorAnto Aravinth <anto.aravinth.cse@gmail.com>2018-11-18 09:07:48 +0530
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2018-11-19 10:47:41 -0800
commiteb42c1eb4f2502433a22c49ede9e657fb6cd86e0 (patch)
treee320dc22531cd7f8f3080b1b3431bdf2702b9418 /lib/readline.js
parent7778c035a0a3f9bbb988eb0298a026d80f423e03 (diff)
downloadandroid-node-v8-eb42c1eb4f2502433a22c49ede9e657fb6cd86e0.tar.gz
android-node-v8-eb42c1eb4f2502433a22c49ede9e657fb6cd86e0.tar.bz2
android-node-v8-eb42c1eb4f2502433a22c49ede9e657fb6cd86e0.zip
repl: handle buffered string logic on finish
Looks like `clearBufferedCommand` will be called on almost all flows. Hence history was broken. PR-URL: https://github.com/nodejs/node/pull/24389 Fixes: https://github.com/nodejs/node/issues/24385 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'lib/readline.js')
-rw-r--r--lib/readline.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/readline.js b/lib/readline.js
index f22d84f1a0..b293292d83 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -348,9 +348,9 @@ Interface.prototype.undoHistory = function() {
// If it's a multiline code, then add history
// accordingly.
-Interface.prototype.multilineHistory = function() {
- // check if we got a multiline code
- if (this.multiline !== '' && this.terminal) {
+Interface.prototype.multilineHistory = function(clearBuffer) {
+ // if not clear buffer, add multiline history
+ if (!clearBuffer && this.terminal) {
const dupIndex = this.history.indexOf(this.multiline);
if (dupIndex !== -1) this.history.splice(dupIndex, 1);
// Remove the last entered line as multiline