Bug report
window.addstr(str, attr) restores the window rendition after the write with wattrset(), whose chtype cannot hold a color pair above 255, so a window using an extended pair loses it.
import curses
def check(stdscr):
curses.start_color()
curses.init_pair(300, curses.COLOR_RED, curses.COLOR_BLACK)
win = curses.newwin(2, 10, 0, 0)
win.color_set(300)
win.addstr(0, 0, 'x', curses.A_BOLD)
return win.attr_get()
print(curses.wrapper(check)) # (0, 0), want (0, 300)
addnstr(), insstr() and insnstr() do the same. wattr_get() and wattr_set() keep the pair.
Extended pairs became settable on a window in 3.16 (gh-152219), so this affects the main branch only.
Linked PRs
Bug report
window.addstr(str, attr)restores the window rendition after the write withwattrset(), whosechtypecannot hold a color pair above 255, so a window using an extended pair loses it.addnstr(),insstr()andinsnstr()do the same.wattr_get()andwattr_set()keep the pair.Extended pairs became settable on a window in 3.16 (gh-152219), so this affects the main branch only.
Linked PRs