]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.15] gh-87881: Document the result of curses inch() and getbkgd() (GH-152488) ...
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 28 Jun 2026 17:06:55 +0000 (20:06 +0300)
committerGitHub <noreply@github.com>
Sun, 28 Jun 2026 17:06:55 +0000 (17:06 +0000)
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)

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

index 5726aee5af89b129d56d27d93d1e7f72c39a47cf..621e3d6ad2043a023494889c8aba17b16fb6d5f2 100644 (file)
@@ -975,6 +975,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])
@@ -1065,8 +1066,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])