REPL import tab completion moves cursor backward
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
When tab completing ambiguous imports in the Python REPL, pressing tab once will insert the longest unambiguous completion and display "[ complete but not unique ]". Pressing tab a second time will show all the possibilities.
In Ghostty, when you press tab the second time, the cursor moves one cell to the left. This happens with cursor-style = bar as well as the default block cursor.
I reproduced this in Ghostty with both fish shell and bash. I could not reproduce this in Zed's integrated terminal (with a bar cursor) or Terminal.app (with a block cursor).
Originally posted by @injust in https://github.com/ghostty-org/ghostty/discussions/11131
I initially reported this issue to Ghostty, and the maintainer's response was:
This is a bug in Terminal.app in how it handles CUB with the cursor in the pending wrap state. Or, a bug in Python's readline in how it calculates the amount to move the cursor back. Your bug reproduces on xterm, and Ghostty matches xterm. Specifically, CUB moves exactly
ncells back ignoring pending wrap in xterm and Ghostty matches this. In Terminal.app, CUB subtracts one when it is in the pending wrap state.
Since the bug reproduces in both Ghostty and xterm, it might be a bug in the Python REPL.
I captured the bug in this asciicast: https://github.com/user-attachments/files/25683940/ascii.cast.json
CPython versions tested on:
3.14
Operating systems tested on:
macOS
Linked PRs
- gh-145727
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Python REPL 中 readline 的 import 补全行为开始,并查看链接的 asciicast,以重现第二次按 Tab 时光标的移动。在终端中比较歧义补全前后的光标位置;当重复进行 Tab 补全不再使光标向后移动时即完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100