8000 bpo-30176: Add missing curses cell attributes constants (GH-1302) · python/cpython@116dd5e · GitHub
[go: up one dir, main page]

Skip to content

Commit 116dd5e

Browse files
zhangyangyuMariatta
authored andcommitted
bpo-30176: Add missing curses cell attributes constants (GH-1302)
1 parent c931885 commit 116dd5e

File tree

3 files changed

+54
-14
lines changed

3 files changed

+54
-14
lines changed

Doc/library/curses.rst

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,34 +1271,70 @@ The :mod:`curses` module defines the following data members:
12711271
A string representing the current version of the module. Also available as
12721272
:const:`__version__`.
12731273

1274-
Several constants are available to specify character cell attributes:
1274+
Some constants are available to specify character cell attributes.
1275+
The exact constants available are system dependent.
12751276

12761277
+------------------+-------------------------------+
12771278
| Attribute | Meaning |
12781279
+==================+===============================+
1279-
| ``A_ALTCHARSET`` | Alternate character set mode. |
1280+
| ``A_ALTCHARSET`` | Alternate character set mode |
12801281
+------------------+-------------------------------+
1281-
| ``A_BLINK`` | Blink mode. |
1282+
| ``A_BLINK`` | Blink mode |
12821283
+------------------+-------------------------------+
1283-
| ``A_BOLD`` | Bold mode. |
1284+
| ``A_BOLD`` | Bold mode |
12841285
+------------------+-------------------------------+
1285-
| ``A_ITALIC`` | Italic mode. |
1286+
| ``A_DIM`` | Dim mode |
12861287
+------------------+-------------------------------+
1287-
| ``A_DIM`` | Dim mode. |
1288+
| ``A_INVIS`` | Invisible or blank mode |
12881289
+------------------+-------------------------------+
1289-
| ``A_NORMAL`` | Normal attribute. |
1290+
| ``A_ITALIC`` | Italic mode |
1291+
+------------------+-------------------------------+
1292+
| ``A_NORMAL`` | Normal attribute |
1293+
+------------------+-------------------------------+
1294+
| ``A_PROTECT`` | Protected mode |
12901295
+------------------+-------------------------------+
12911296
| ``A_REVERSE`` | Reverse background and |
1292-
| | foreground colors. |
1297+
| | foreground colors |
1298+
+------------------+-------------------------------+
1299+
| ``A_STANDOUT`` | Standout mode |
1300+
+------------------+-------------------------------+
1301+
| ``A_UNDERLINE`` | Underline mode |
1302+
+------------------+-------------------------------+
1303+
| ``A_HORIZONTAL`` | Horizontal highlight |
1304+
+------------------+-------------------------------+
1305+
| ``A_LEFT`` | Left highlight |
1306+
+------------------+-------------------------------+
1307+
| ``A_LOW`` | Low highlight |
1308+
+------------------+-------------------------------+
1309+
| ``A_RIGHT`` | Right highlight |
12931310
+------------------+-------------------------------+
1294-
| ``A_STANDOUT`` | Standout mode. |
1311+
| ``A_TOP`` | Top highlight |
12951312
+------------------+-------------------------------+
1296-
| ``A_UNDERLINE`` | Underline mode. |
1313+
| ``A_VERTICAL`` | Vertical highlight |
1314+
+------------------+-------------------------------+
1315+
| ``A_CHARTEXT`` | Bit-mask to extract a |
1316+
| | character |
12971317
+------------------+-------------------------------+
12981318

12991319
.. versionadded:: 3.7
13001320
``A_ITALIC`` was added.
13011321

1322+
Several constants are available to extract corresponding attributes returned
1323+
by some methods.
1324+
1325+
+------------------+-------------------------------+
1326+
| Bit-mask | Meaning |
1327+
+==================+===============================+
1328+
| ``A_ATTRIBUTES`` | Bit-mask to extract |
1329+
| | attributes |
1330+
+------------------+-------------------------------+
1331+
| ``A_CHARTEXT`` | Bit-mask to extract a |
1332+
| | character |
1333+
+------------------+-------------------------------+
1334+
| ``A_COLOR`` | Bit-mask to extract |
1335+
| | color-pair field information |
1336+
+------------------+-------------------------------+
1337+
13021338
Keys are referred to by integer constants with names starting with ``KEY_``.
13031339
The exact keycaps available are system dependent.
13041340

Misc/NEWS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ Library
445445
- bpo-30149: inspect.signature() now supports callables with
446446
variable-argument parameters wrapped with partialmethod.
447447
Patch by Dong-hee Na.
448-
448+
449449
- bpo-30436: importlib.find_spec() raises ModuleNotFoundError instead of
450450
AttributeError if the specified parent module is not a package
451451
(i.e. lacks a __path__ attribute).
@@ -1216,6 +1216,8 @@ C API
12161216
Documentation
12171217
-------------
12181218

1219+
- bpo-30176: Add missing attribute related constants in curses documentation.
1220+
12191221
- Issue #30052: the link targets for :func:`bytes` and
12201222
:func:`bytearray` are now their respective type definitions, rather
12211223
than the corresponding builtin function entries. Use :ref:`bytes <func-bytes>`

Modules/_cursesmodule.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3335,9 +3335,6 @@ PyInit__curses(void)
33353335
SetDictInt("A_BLINK", A_BLINK);
33363336
SetDictInt("A_DIM", A_DIM);
33373337
SetDictInt("A_BOLD", A_BOLD);
3338-
#ifdef A_ITALIC
3339-
SetDictInt("A_ITALIC", A_ITALIC);
3340-
#endif
33413338
SetDictInt("A_ALTCHARSET", A_ALTCHARSET);
33423339
#if !defined(__NetBSD__)
33433340
SetDictInt("A_INVIS", A_INVIS);
@@ -3366,6 +3363,11 @@ PyInit__curses(void)
33663363
SetDictInt("A_VERTICAL", A_VERTICAL);
33673364
#endif
33683365

3366+
/* ncurses extension */
3367+
#ifdef A_ITALIC
3368+
SetDictInt("A_ITALIC", A_ITALIC);
3369+
#endif
3370+
33693371
SetDictInt("COLOR_BLACK", COLOR_BLACK);
33703372
SetDictInt("COLOR_RED", COLOR_RED);
33713373
SetDictInt("COLOR_GREEN", COLOR_GREEN);

0 commit comments

Comments
 (0)
0