]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-87881: Document the result of curses inch() and getbkgd() (GH-152488) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 28 Jun 2026 17:19:17 +0000 (19:19 +0200)
committerGitHub <noreply@github.com>
Sun, 28 Jun 2026 17:19:17 +0000 (20:19 +0300)
Explain the character/attribute bit layout and how to extract the parts
(A_CHARTEXT and A_ATTRIBUTES bit-masks, pair_number() for the color pair).
(cherry picked from commit d831a690766e92b3be5e40134f64407bd041bcbf)
(cherry picked from commit 09013312bbdf9ff6583c95ba6bc2698e61c66be6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Doc/library/curses.rst

index 68154029af564d92faa961df4e0e6ce57fcf839b..32d328283671d7d5da786824cf85566c8169f4d0 100644 (file)
@@ -955,6 +955,7 @@ Window objects
 .. method:: window.getbkgd()
 
    Return the given window's current background character/attribute pair.
+   Its components can be extracted like those of :meth:`inch`.
 
 
 .. method:: window.getch([y, x])
@@ -1042,8 +1043,10 @@ Window objects
 
 .. method:: window.inch([y, x])
 
-   Return the character at the given position in the window. The bottom 8 bits are
-   the character proper, and upper bits are the attributes.
+   Return the character at the given position in the window.
+   The bottom 8 bits are the character proper and the upper bits are the attributes;
+   extract them with the :data:`A_CHARTEXT` and :data:`A_ATTRIBUTES` bit-masks,
+   and the color pair with :func:`pair_number`.
 
 
 .. method:: window.insch(ch[, attr])