[Bug] Multiselect leaves a stale prompt fragment after terminal resize with wrapped hints
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
调研方向
Start by running the standalone @clack/prompts reproduction in repro.mjs with the resize sequence described, then inspect the multiselect renderer and frame erasure logic. Compare redraw behavior across terminal widths and check whether wrapped hints and rows scrolled out of view are accounted for. Done when resizing and pressing Down leaves only the current prompt visible; the issue names no repository source files or tests.
由索引模型根据 Issue 内容生成。
描述
Environment
- OS: Ubuntu 24.04.5
- Node Version: 24.21.0
- Package:
@clack/prompts - Package Version: 1.8.1
Describe the bug
A multiselect prompt with long option hints leaves part of its previous frame at the top of the terminal after a width change and a navigation keypress. The active prompt continues to respond to Down and Ctrl-C, but the old text remains visible above it.
I reproduced this in a standalone @clack/prompts app with version 1.8.1, independent of Storybook. It occurs in tmux and in an xterm.js 5.5.0 PTY replay.
To Reproduce
package.json:
{"private":true,"type":"module","dependencies":{"@clack/prompts":"1.8.1"}}
repro.mjs
import { multiselect } from '@clack/prompts';
const options = [
'eslintPlugin',
'component-subtitle',
'argtypes-default-value',
'story-sort-to-main',
'remove-experimental-review',
'skills',
].map((label) => ({
value: label,
label,
hint: `Move deprecated parameters.componentSubtitle values to parameters.docs.subtitle\nMore info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#parameterscomponentsubtitle-removed`,
}));
await multiselect({
message: 'Select automigrations to run',
options,
initialValues: ['eslintPlugin'],
required: false,
});
Run npm install --no-audit --no-fund and node repro.mjs in a 120x40 terminal. Resize to 40x30, then press Down. A fragment of the old prompt stays at the top. Resize to 80x24 and press Down; the fragment persists. The current selection still moves, and Ctrl-C still works.
For a deterministic tmux replay:
tmux -L clack-resize new-session -d -x 120 -y 40 -s repro 'node repro.mjs'
tmux -L clack-resize resize-window -t repro -x 40 -y 30
tmux -L clack-resize send-keys -t repro Down
tmux -L clack-resize capture-pane -t repro -p
tmux -L clack-resize resize-window -t repro -x 80 -y 24
tmux -L clack-resize send-keys -t repro Down
tmux -L clack-resize capture-pane -t repro -p
Expected behavior
After each resize and redraw, the old prompt frame is fully cleared and only the current prompt is visible.
** Actual behavior **
The top row retains a fragment of the prior, wider frame (for example, the end of parameters.docs.subtitle). The current frame is drawn below it. The problem remains after widening the terminal again.
Additional Information
- Ubuntu 24.04.5; Node 24.21.0; npm 11.19.0; TERM=xterm-256color.
- Reproduced in tmux and in xterm.js 5.5.0.
- @clack/prompts 1.0.0-alpha.7 and 1.8.1 both reproduce.
- The renderer appears to recalculate the previous frame's wrapping using the new terminal width when erasing. Wrapped rows that have scrolled above the viewport cannot then be erased. The multiselect viewport also appears to count options without accounting for all visual rows used by wrapped hints. These are hypotheses from the reproducer, not a confirmed fix.
Related: PR #577 addresses multiselect line counts on narrow terminals, but I have not verified this resize sequence against that PR.
- 主要语言
- TypeScript
- 星标
- 8.1k
- 派生
- 225
- 平均合并
- 12 小时 54 分钟
- 30 天内合并 PR
- 3
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bombshell-dev/clack 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 58/100
bombshell-dev/clack#629 ·
维护者通常 1 天内回复
-
[Bug] Prompts never settle when stdin ends可能已有人在做 @MFA-G 于 8 天前认领。 未关闭
难度 3/5 半天 新手友好度 55/100
bombshell-dev/clack#615 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 70/100
bombshell-dev/clack#613 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
bombshell-dev/clack#597 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
bombshell-dev/clack#585 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
查看 bombshell-dev/clack 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 83/100
keptinventory/kept#336 ·
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 84/100
-
hemi-earn
难度 2/5 1-3 小时 新手友好度 72/100
vetro-protocol/vetro-monorepo#1013 ·
维护者通常 1 天内回复