A combining mark in a `Textbox`'s last cell loses the base character
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- 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