nodejs / nodejs/node

readline: prompt opt-out behavior

未关闭
#12,606 10 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

confirmed-bug help wanted readline
主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

  • 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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先在 Windows 上运行提供的 readline echo 界面,并复现 DELETE、BACKSPACE 或 UP 之后出现的 prompt。将其行为与显式为空的 prompt 进行比较,然后检查 readline 输入和 prompt 处理的入口点;当 opt-out 行为已定义,并且意外的 prompt 行为已得到修复或记录时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, nodejs
领域
cli
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。