Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2fa8170

Browse filesBrowse files
BridgeARaddaleax
authored andcommitted
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: #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>
1 parent f636f15 commit 2fa8170
Copy full SHA for 2fa8170

File tree

Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed
Open diff view settings
Collapse file

‎lib/repl.js‎

Copy file name to clipboardExpand all lines: lib/repl.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,11 @@ function REPLServer(prompt,
701701
return;
702702
}
703703
if (!self.editorMode || !self.terminal) {
704+
// Before exiting, make sure to clear the line.
705+
if (key.ctrl && key.name === 'd' &&
706+
self.cursor === 0 && self.line.length === 0) {
707+
self.clearLine();
708+
}
704709
ttyWrite(d, key);
705710
return;
706711
}
Collapse file

‎test/parallel/test-repl-save-load.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-repl-save-load.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'),
7070
putIn.run([`.save ${saveFileName}`]);
7171
replServer.close();
7272
assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'),
73-
`${cmds.join('\n')}\n`);
73+
`${cmds.join('\n')}\n\n`);
7474
}
7575

7676
// make sure that the REPL data is "correct"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.