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
Some curses methods silently truncate a color pair or attributes that do not fit in a chtype, turning a range error into a wrong-rendering bug instead of an exception:
addch, addstr, addnstr, insch, insstr, insnstr, bkgd, bkgdset, echochar, hline, vline, box, border, attron, attroff, attrset and slk_attron/slk_attroff/slk_attrset take a raw long attr and narrow anything outside 0 .. 0xFFFFFFFF.
This is inconsistent with the rest of the module, which already raises rather than truncating: pair_converter (pair > INT_MAX/COLOR_PAIRS-1), component_converter (RGB outside 0..1000), attr_converter (gh-152219, value > (attr_t)-1) and curses_setcchar (pair beyond a short).
Bug report
Some
cursesmethods silently truncate a color pair or attributes that do not fit in achtype, turning a range error into a wrong-rendering bug instead of an exception:curses.color_pair(n)masksninto the chtype's ~8-bit color field, so a pair ≥ 256 wraps to a lower pair and shows the wrong colors with no error (Ncurses Extended Color Pairs incorrectly display as copies of lower 256 color pairs #119138).addch,addstr,addnstr,insch,insstr,insnstr,bkgd,bkgdset,echochar,hline,vline,box,border,attron,attroff,attrsetandslk_attron/slk_attroff/slk_attrsettake a rawlong attrand narrow anything outside0 .. 0xFFFFFFFF.This is inconsistent with the rest of the module, which already raises rather than truncating:
pair_converter(pair >INT_MAX/COLOR_PAIRS-1),component_converter(RGB outside0..1000),attr_converter(gh-152219, value >(attr_t)-1) andcurses_setcchar(pair beyond ashort).Linked PRs