You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add curses window attribute get/set methods and WA_* constants #152219
The curses module wraps the legacy attron()/attroff()/attrset() functions, which take a chtype (where the color pair is packed into the value via COLOR_PAIR()), but it does not expose the X/Open attr_t-based family that passes the color pair as a separate argument:
wattr_get() / wattr_set()
wattr_on() / wattr_off()
wcolor_set()
These are the modern, recommended forms: they keep the attribute bits (A_* / WA_*) and the color pair separate, which is what cchar_t-based wide-character output (add_wch() etc.) already uses internally. The legacy functions also can't address color pairs above 255 without the pair number colliding with the attribute bits.
This issue proposes adding the corresponding window methods:
window.attr_get() → (attributes, pair) — current attribute bits and color pair
window.attr_set(attr, pair=0) — set attribute bits and color pair
window.attr_on(attr) — turn attribute bits on
window.attr_off(attr) — turn attribute bits off
window.color_set(pair) — set just the color pair
and the associated WA_* attribute constants (WA_NORMAL, WA_BOLD, WA_UNDERLINE, WA_REVERSE, WA_BLINK, WA_DIM, WA_STANDOUT, WA_ALTCHARSET, WA_INVIS, WA_PROTECT, WA_ITALIC, WA_HORIZONTAL, WA_LEFT, WA_LOW, WA_RIGHT, WA_TOP, WA_VERTICAL, WA_ATTRIBUTES), each guarded by #ifdef for portability. On ncurses the WA_* values are bit-identical to the matching A_* values.
The color_set part overlaps with the long-standing gh-49618 (which also asks for the unrelated addchstr family); this issue scopes the attribute get/set surface specifically.
Activity
gh-152219: Add curses window attribute get/set methods and WA_* const…