Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Lib/test/test_curses.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,15 @@ def test_in_wch_color(self):
stdscr.addch(0, 0, curses.complexchar('A', curses.A_BOLD, 1))
cc = stdscr.in_wch(0, 0)
self.assertEqual(str(cc), 'A')
self.assertTrue(cc.attr & curses.A_BOLD)
self.assertEqual(cc.attr, curses.A_BOLD)
self.assertEqual(cc.pair, 1)
self.assertEqual(curses.complexchar('A', 0, 1).pair, 1)
# attr never carries the color pair, not even a pair that does not fit
# in a color_pair() value.
self.assertEqual(curses.complexchar('A', 0, 1).attr, 0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestCurses.test_complexchar is probably a better place for these new tests.

self.assertEqual(curses.complexchar('A', 0, 300).attr, 0)
self.assertEqual(curses.complexchar('A', curses.A_BOLD, 1).attr,
curses.A_BOLD)

def test_getbkgrnd(self):
# getbkgrnd() returns the background as a complexchar (getbkgd() can
Expand Down
1 change: 1 addition & 0 deletions Modules/_cursesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ curses_cell_attr_pair(cursesmodule_state *state, const curses_cell_t *cell,
PyErr_SetString(state->error, "getcchar() returned ERR");
return -1;
}
*attr &= ~(attr_t)A_COLOR;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would curses_getcchar() be a better place for the mask?

return 0;
#else
*attr = *cell & A_ATTRIBUTES & ~(attr_t)A_COLOR;
Expand Down
Loading