readline: prompt opt-out behavior
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
- Version: v8.0.0-rc.0
- Platform: Windows 4 x64
- Subsystem: readline
I am not sure if this is a bug or a feature.
Consider this simple echo interface:
'use strict';
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.on('line', (line) => {
console.log(line);
});
It does not use rl.prompt() anywhere and with a common input there will be no default prompt:
GIF 1:

However, if a user press DELETE, BACKSPACE or UP button, default prompt immediately and somehow unexpectedly appears shifting the whole line:
GIF 2:

This can be prevented by setting the prompt option into the empty line. However, I am not sure if this opt-out rule is an intended behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided readline echo interface on Windows and reproduce the prompt appearing after DELETE, BACKSPACE, or UP. Compare the behavior with an explicitly empty prompt, then inspect the readline input and prompt-handling entry points; done means the opt-out behavior is defined and the unexpected prompt behavior is addressed or documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100