mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
repl: add new line on ctrl+d
Currently the repl ends on the same line which procudes a weird output. To prevent that, just add a new line in case of ctrl+d. PR-URL: https://github.com/nodejs/node/pull/26240 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
1 parent
f636f15315
commit
2fa8170e51
2 files changed
+6
-1
No files matched your search
@@ -701,6 +701,11 @@ function REPLServer(prompt,
|
||||
return;
|
||||
}
|
||||
if (!self.editorMode || !self.terminal) {
|
||||
// Before exiting, make sure to clear the line.
|
||||
if (key.ctrl && key.name === 'd' &&
|
||||
self.cursor === 0 && self.line.length === 0) {
|
||||
self.clearLine();
|
||||
}
|
||||
ttyWrite(d, key);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'),
|
||||
putIn.run([`.save ${saveFileName}`]);
|
||||
replServer.close();
|
||||
assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'),
|
||||
`${cmds.join('\n')}\n`);
|
||||
`${cmds.join('\n')}\n\n`);
|
||||
}
|
||||
|
||||
// make sure that the REPL data is "correct"
|
||||
|
||||
Reference in new issue
Block a user