diff options
-rw-r--r-- | lib/libncurses/lib_addch.c | 8 | ||||
-rw-r--r-- | lib/libncurses/lib_bkgd.c | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/libncurses/lib_addch.c b/lib/libncurses/lib_addch.c index 00684ed..5ec6576 100644 --- a/lib/libncurses/lib_addch.c +++ b/lib/libncurses/lib_addch.c @@ -56,10 +56,14 @@ chtype ch = c; T(("win attr = %x", win->_attrs)); ch |= win->_attrs; - if (win->_line[y][x]&A_CHARTEXT == ' ') - ch |= win->_bkgd; + /* Don't attempt to replace any given attributes */ + if ((ch&A_ATTRIBUTES) == A_NORMAL) { + if (ch == ' ') + ch = win->_bkgd; else ch |= (win->_bkgd&A_ATTRIBUTES); + } + T(("bkg = %x -> ch = %x", win->_bkgd, ch)); if (win->_line[y][x] != ch) { diff --git a/lib/libncurses/lib_bkgd.c b/lib/libncurses/lib_bkgd.c index 0210995..f54e4d1 100644 --- a/lib/libncurses/lib_bkgd.c +++ b/lib/libncurses/lib_bkgd.c @@ -27,10 +27,13 @@ int x, y; T(("wbkgd(%x, %x) called", win, ch)); for (y = 0; y < win->_maxy; y++) for (x = 0; x < win->_maxx; x++) - if (win->_line[y][x]&A_CHARTEXT == ' ') - win->_line[y][x] |= ch; + /* Don't attempt to replace existing attrs */ + if ((win->_line[y][x]&A_ATTRIBUTES) == A_NORMAL) { + if (win->_line[y][x] == ' ') + win->_line[y][x] = ch; else win->_line[y][x] |= (ch&A_ATTRIBUTES); + } touchwin(win); return OK; } |