nodejs / nodejs/node

readline: prompt opt-out behavior

Open
#12,606 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

confirmed-bug help wanted readline
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:

1


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

GIF 2:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.