| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
… constants Add the window methods attr_get(), attr_set(), attr_on(), attr_off() and color_set(), wrapping wattr_get(), wattr_set(), wattr_on(), wattr_off() and wcolor_set(). Unlike the legacy attron()/attroff()/attrset() methods, these pass the color pair as a separate argument instead of packing it into the attribute value. Also add the corresponding WA_* attribute constants. Add an attr_converter that range-checks the attr_t attribute argument and raises OverflowError instead of silently truncating it; apply it to attr_set(), attr_on(), attr_off() and chgat(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documentation build overview4 files changed ± library/curses.html ± library/stdtypes.html ± whatsnew/3.16.html ± whatsnew/changelog.html |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Add the curses window methods attr_get(), attr_set(), attr_on(), attr_off() and color_set(), wrapping wattr_get(), wattr_set(), wattr_on(), wattr_off() and wcolor_set().
Unlike the legacy attron()/attroff()/attrset() methods, which take a chtype with the color pair packed in via COLOR_PAIR(), these pass the color pair as a separate argument. This is the form used internally by the cchar_t-based wide-character output, and it can address color pairs beyond 255 without colliding with the attribute bits.
Also add the corresponding 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 and the placement constants), each guarded by #ifdef. On ncurses they are bit-identical to the matching A_* values.
This PR adds an attr_converter that range-checks the attr_t argument and raises OverflowError instead of silently truncating; it is applied to attr_set(), attr_on(), attr_off() and chgat(). A converter for the chtype-style methods (addch, bkgd, hline, etc.) is left for a separate issue.