A combining mark in a `Textbox`'s last cell loses the base character
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug description:
Typing a combining mark into the lower-right cell of a curses.textpad.Textbox puts the mark in a cell of its own and pushes the character it should attach to off the window edge, so that character is lost. The same keystrokes one column earlier attach the mark correctly. Doc/library/curses.rst says of Textbox that "Entering and reading back the full Unicode range, including combining characters, is now supported when curses is built with wide-character support".
import curses, sys
from curses.textpad import Textbox
def typed(ncols):
win = curses.newwin(1, ncols, 0, 0)
box = Textbox(win)
for ch in 'abe\u0301': # COMBINING ACUTE ACCENT after the 'e'
box.do_command(ch)
return win.instr(0, 0, 40).decode()
out = curses.wrapper(lambda stdscr: (typed(3), typed(10)))
print('3 columns: %a\n10 columns: %a' % out, file=sys.stderr)
Output:
3 columns: 'ab\u0301'
10 columns: 'abe\u0301 '
Expected 'abe\u0301' from both windows: the mark should join the e instead of taking its cell.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-157211
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 curses.textpad.Textbox.do_command 开始,并在 Linux 上使用提供的三列和十列示例重现该问题。检查 Doc/library/curses.rst 中所述的 Unicode 行为;当两个窗口都将基本字符和组合标记保留为 'abe\u0301' 时完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100