Five curses documentation statements contradict the implementation
未關閉
還沒有人認領這個 Issue。
docs
topic-curses
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
Documentation
Five statements in Doc/library/curses.rst describe behaviour the module does not have.
| documented | says | actually |
|---|---|---|
halfdelay() |
"raise an exception if nothing has been typed" | getch() returns -1 |
termname() |
"truncated to 14 characters" | returns the full name |
window.scroll() |
"no effect unless it has been enabled ... with scrollok" |
raises curses.error |
window.insnstr() |
"If n is zero or negative, the entire string is inserted" | zero inserts nothing |
window.insch() |
"The cursor position does not change" | the (y, x) form moves it |
$ TERM=screen.xterm-256color ./python repro.py; cat out.txt
halfdelay(2); getch() -> -1
termname() -> b'screen.xterm-256color'
scroll() no scrollok -> curses.error: wscrl() (called by scroll()) returned ERR
insnstr('ABC', 0) -> '....'
insch(3, 5, ch); getyx -> (3, 5)
repro.py
import curses
out = []
stdscr = curses.initscr()
try:
curses.cbreak()
curses.halfdelay(2)
out.append(f"halfdelay(2); getch() -> {stdscr.getch()!r}")
curses.cbreak()
out.append(f"termname() -> {curses.termname()!r}")
w = curses.newwin(5, 20, 0, 0)
w.scrollok(False)
try:
w.scroll(1)
out.append("scroll() no scrollok -> returned None")
except curses.error as e:
out.append(f"scroll() no scrollok -> curses.error: {e}")
w.addstr(2, 0, "....")
w.move(2, 0)
w.insnstr("ABC", 0)
out.append(f"insnstr('ABC', 0) -> {w.instr(2, 0, 4).decode()!r}")
w.insch(3, 5, ord('x'))
out.append(f"insch(3, 5, ch); getyx -> {w.getyx()}")
finally:
curses.endwin()
open("out.txt", "w").write("\n".join(out) + "\n")
Linked PRs
- gh-157141
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
開啟 Doc/library/curses.rst,並將列出的五項陳述與 repro.py 的輸出進行比較。在開始之前檢查已連結的 PR gh-157141;當所有五項已記錄的行為都與所展示的實作相符時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 1/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 25/100