Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/internal/readline/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ function* emitKeys(stream) {

// This runs in O(n log n).
function commonPrefix(strings) {
if (strings.length === 0) {
return '';
}
if (strings.length === 1) {
return strings[0];
}
Expand Down
21 changes: 21 additions & 0 deletions test/parallel/test-repl-tab-complete-on-editor-mode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

require('../common');
const ArrayStream = require('../common/arraystream');
const repl = require('repl');

const stream = new ArrayStream();
const replServer = repl.start({
input: stream,
output: stream,
terminal: true,
});

// Editor mode
replServer.write('.editor\n');

// Regression test for https://github.com/nodejs/node/issues/43528
replServer.write('a');
replServer.write(null, { name: 'tab' }); // Should not throw

replServer.close();