[issue37738] curses.addch('a', curses.color_pair(1)) ignores the color information

STINNER Victor report at bugs.python.org
Wed Aug 14 06:40:24 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

On my Fedora 30 with libncursesw, A_COLOR = 0xff00.

After my change, _curses uses:

    static inline short
    attr_to_color_pair(int attr)
    {
        return (short)((attr & A_COLOR) >> 8);
    }

    ...
    setcchar(&wcval, wstr, attr, attr_to_color_pair(attr), NULL);
    ...

If someone gets troubles with attr passed "directly" as the 3rd argument of setcchar(), we can try to pass (attr & ~A_COLOR) instead. On my Linux, it would mean: only pass the low 8 bits of attr.

But since it "just" works on my Linux, I prefer to only make minimum changes to fix this issue on Linux.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37738>
_______________________________________


More information about the Python-bugs-list mailing list