diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c index 934c16e80d81..a3ccb1bb6910 100644 --- a/lib/libcurses/addbytes.c +++ b/lib/libcurses/addbytes.c @@ -1,4 +1,4 @@ -/* $NetBSD: addbytes.c,v 1.29 2003/08/10 07:37:11 dsl Exp $ */ +/* $NetBSD: addbytes.c,v 1.30 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: addbytes.c,v 1.29 2003/08/10 07:37:11 dsl Exp $"); +__RCSID("$NetBSD: addbytes.c,v 1.30 2006/01/15 11:43:54 jdc Exp $"); #endif #endif /* not lint */ @@ -189,10 +189,15 @@ __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr) *lp->firstchp - win->ch_off, *lp->lastchp - win->ch_off); #endif - lp->line[x].ch = c; - lp->line[x].bch = win->bch; - lp->line[x].attr = attributes; - lp->line[x].battr = win->battr; + if (win->bch != ' ' && c == ' ') + lp->line[x].ch = win->bch; + else + lp->line[x].ch = c; + if (attributes & __COLOR) + lp->line[x].attr = + attributes | (win->battr & ~__COLOR); + else + lp->line[x].attr = attributes | win->battr; if (x == win->maxx - 1) lp->flags |= __ISPASTEOL; else diff --git a/lib/libcurses/background.c b/lib/libcurses/background.c index f7ad06738473..b9e2bc24ed7e 100644 --- a/lib/libcurses/background.c +++ b/lib/libcurses/background.c @@ -1,4 +1,4 @@ -/* $NetBSD: background.c,v 1.8 2003/02/17 11:07:19 dsl Exp $ */ +/* $NetBSD: background.c,v 1.9 2006/01/15 11:43:54 jdc Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: background.c,v 1.8 2003/02/17 11:07:19 dsl Exp $"); +__RCSID("$NetBSD: background.c,v 1.9 2006/01/15 11:43:54 jdc Exp $"); #endif /* not lint */ #include "curses.h" @@ -108,10 +108,16 @@ wbkgd(WINDOW *win, chtype ch) wbkgdset(win, ch); for (y = 0; y < win->maxy; y++) for (x = 0; x < win->maxx; x++) { - if (ch & A_CHARTEXT) - win->lines[y]->line[x].bch = ch & __CHARTEXT; - win->lines[y]->line[x].battr = - (attr_t) ch & __ATTRIBUTES; + /* Copy character if space */ + if (ch & A_CHARTEXT && win->lines[y]->line[x].ch == ' ') + win->lines[y]->line[x].ch = ch & __CHARTEXT; + /* Merge attributes */ + if (win->lines[y]->line[x].attr & __ALTCHARSET) + win->lines[y]->line[x].attr = + (ch & __ATTRIBUTES) | __ALTCHARSET; + else + win->lines[y]->line[x].attr = + ch & __ATTRIBUTES; } __touchwin(win); return(OK); diff --git a/lib/libcurses/border.c b/lib/libcurses/border.c index aa75ea2084fd..e913f8499752 100644 --- a/lib/libcurses/border.c +++ b/lib/libcurses/border.c @@ -1,4 +1,4 @@ -/* $NetBSD: border.c,v 1.7 2001/02/05 21:54:21 jdc Exp $ */ +/* $NetBSD: border.c,v 1.8 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: border.c,v 1.7 2001/02/05 21:54:21 jdc Exp $"); +__RCSID("$NetBSD: border.c,v 1.8 2006/01/15 11:43:54 jdc Exp $"); #endif /* not lint */ #include "curses.h" @@ -109,15 +109,23 @@ wborder(WINDOW *win, chtype left, chtype right, chtype top, chtype bottom, botright & __ATTRIBUTES); #endif - /* Merge window attributes */ + /* Merge window and background attributes */ left |= (left & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + left |= (left & __COLOR) ? (win->battr & ~__COLOR) : win->battr; right |= (right & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + right |= (right & __COLOR) ? (win->battr & ~__COLOR) : win->battr; top |= (top & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + top |= (top & __COLOR) ? (win->battr & ~__COLOR) : win->battr; bottom |= (bottom & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + bottom |= (bottom & __COLOR) ? (win->battr & ~__COLOR) : win->battr; topleft |= (topleft & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + topleft |= (topleft & __COLOR) ? (win->battr & ~__COLOR) : win->battr; topright |= (topright & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + topright |= (topright & __COLOR) ? (win->battr & ~__COLOR) : win->battr; botleft |= (botleft & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + botleft |= (botleft & __COLOR) ? (win->battr & ~__COLOR) : win->battr; botright |= (botright & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + botright |= (botright & __COLOR) ? (win->battr & ~__COLOR) : win->battr; endx = win->maxx - 1; endy = win->maxy - 1; @@ -127,44 +135,28 @@ wborder(WINDOW *win, chtype left, chtype right, chtype top, chtype bottom, /* Sides */ for (i = 1; i < endy; i++) { win->lines[i]->line[0].ch = (wchar_t) left & __CHARTEXT; - win->lines[i]->line[0].bch = win->bch; win->lines[i]->line[0].attr = (attr_t) left & __ATTRIBUTES; - win->lines[i]->line[0].battr = win->battr; win->lines[i]->line[endx].ch = (wchar_t) right & __CHARTEXT; - win->lines[i]->line[endx].bch = win->bch; win->lines[i]->line[endx].attr = (attr_t) right & __ATTRIBUTES; - win->lines[i]->line[endx].battr = win->battr; } for (i = 1; i < endx; i++) { fp[i].ch = (wchar_t) top & __CHARTEXT; - fp[i].bch = win->bch; fp[i].attr = (attr_t) top & __ATTRIBUTES; - fp[i].battr = win->battr; lp[i].ch = (wchar_t) bottom & __CHARTEXT; - lp[i].bch = win->bch; lp[i].attr = (attr_t) bottom & __ATTRIBUTES; - lp[i].battr = win->battr; } /* Corners */ if (!(win->maxx == LINES && win->maxy == COLS && (win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN))) { fp[0].ch = (wchar_t) topleft & __CHARTEXT; - fp[0].bch = win->bch; fp[0].attr = (attr_t) topleft & __ATTRIBUTES; - fp[0].battr = win->battr; fp[endx].ch = (wchar_t) topright & __CHARTEXT; - fp[endx].bch = win->bch; fp[endx].attr = (attr_t) topright & __ATTRIBUTES; - fp[endx].battr = win->battr; lp[0].ch = (wchar_t) botleft & __CHARTEXT; - lp[0].bch = win->bch; lp[0].attr = (attr_t) botleft & __ATTRIBUTES; - lp[0].battr = win->battr; lp[endx].ch = (wchar_t) botright & __CHARTEXT; - lp[endx].bch = win->bch; lp[endx].attr = (attr_t) botright & __ATTRIBUTES; - lp[endx].battr = win->battr; } __touchwin(win); return (OK); diff --git a/lib/libcurses/clrtobot.c b/lib/libcurses/clrtobot.c index 79746845ab29..ebe3fc056cb0 100644 --- a/lib/libcurses/clrtobot.c +++ b/lib/libcurses/clrtobot.c @@ -1,4 +1,4 @@ -/* $NetBSD: clrtobot.c,v 1.15 2003/08/07 16:44:19 agc Exp $ */ +/* $NetBSD: clrtobot.c,v 1.16 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: clrtobot.c,v 1.15 2003/08/07 16:44:19 agc Exp $"); +__RCSID("$NetBSD: clrtobot.c,v 1.16 2006/01/15 11:43:54 jdc Exp $"); #endif #endif /* not lint */ @@ -64,6 +64,7 @@ wclrtobot(WINDOW *win) { int minx, startx, starty, y; __LDATA *sp, *end, *maxx; + attr_t attr; #ifdef __GNUC__ maxx = NULL; /* XXX gcc -Wuninitialized */ @@ -75,19 +76,20 @@ wclrtobot(WINDOW *win) starty = win->cury; startx = win->curx; } + if (__using_color && win != curscr) + attr = __default_color; + else + attr = 0; for (y = starty; y < win->maxy; y++) { minx = -1; end = &win->lines[y]->line[win->maxx]; for (sp = &win->lines[y]->line[startx]; sp < end; sp++) - if (sp->ch != ' ' || sp->attr != 0 || - sp->bch != win->bch || sp->battr != win->battr) { + if (sp->ch != ' ' || sp->attr != attr) { maxx = sp; if (minx == -1) minx = sp - win->lines[y]->line; sp->ch = ' '; - sp->bch = win->bch; - sp->attr = 0; - sp->battr = win->battr; + sp->attr = attr; } if (minx != -1) __touchline(win, y, minx, maxx - win->lines[y]->line); diff --git a/lib/libcurses/clrtoeol.c b/lib/libcurses/clrtoeol.c index b4e2d288e888..15cc361ed4ee 100644 --- a/lib/libcurses/clrtoeol.c +++ b/lib/libcurses/clrtoeol.c @@ -1,4 +1,4 @@ -/* $NetBSD: clrtoeol.c,v 1.18 2003/10/05 08:26:02 jdc Exp $ */ +/* $NetBSD: clrtoeol.c,v 1.19 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: clrtoeol.c,v 1.18 2003/10/05 08:26:02 jdc Exp $"); +__RCSID("$NetBSD: clrtoeol.c,v 1.19 2006/01/15 11:43:54 jdc Exp $"); #endif #endif /* not lint */ @@ -64,6 +64,7 @@ wclrtoeol(WINDOW *win) { int minx, x, y; __LDATA *end, *maxx, *sp; + attr_t attr; y = win->cury; x = win->curx; @@ -80,16 +81,17 @@ wclrtoeol(WINDOW *win) end = &win->lines[y]->line[win->maxx]; minx = -1; maxx = &win->lines[y]->line[x]; + if (__using_color && win != curscr) + attr = __default_color; + else + attr = 0; for (sp = maxx; sp < end; sp++) - if (sp->ch != ' ' || sp->attr != 0 || - sp->bch != win->bch || sp->battr != win->battr) { + if (sp->ch != ' ' || sp->attr != attr) { maxx = sp; if (minx == -1) minx = sp - win->lines[y]->line; sp->ch = ' '; - sp->bch = win->bch; - sp->attr = 0; - sp->battr = win->battr; + sp->attr = attr; } #ifdef DEBUG __CTRACE("CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", diff --git a/lib/libcurses/color.c b/lib/libcurses/color.c index 296c8a2e017f..c363bf3f53a8 100644 --- a/lib/libcurses/color.c +++ b/lib/libcurses/color.c @@ -1,4 +1,4 @@ -/* $NetBSD: color.c,v 1.29 2004/03/22 18:57:38 jdc Exp $ */ +/* $NetBSD: color.c,v 1.30 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: color.c,v 1.29 2004/03/22 18:57:38 jdc Exp $"); +__RCSID("$NetBSD: color.c,v 1.30 2006/01/15 11:43:54 jdc Exp $"); #endif /* not lint */ #include "curses.h" @@ -246,21 +246,14 @@ start_color(void) /* Set all positions on all windows to curses default colours. */ for (wlp = _cursesi_screen->winlistp; wlp != NULL; wlp = wlp->nextp) { win = wlp->winp; - if (wlp->winp == curscr) { - /* Reset colour attribute on curscr */ - for (y = 0; y < curscr->maxy; y++) - for (x = 0; x < curscr->maxx; x++) { - if ((curscr->lines[y]->line[x].battr & __COLOR) == __default_color) - curscr->lines[y]->line[x].battr &= ~__COLOR; - } - } else if (wlp->winp != __virtscr) { - /* Set background attribute on other windows */ - if (!(win->battr & __COLOR)) - win->battr |= __default_color; + if (wlp->winp != __virtscr && wlp->winp != curscr) { + /* Set color attribute on other windows */ + win->battr |= __default_color; for (y = 0; y < win->maxy; y++) { - for (x = 0; x < win->maxx; x++) - if (!(win->lines[y]->line[x].battr & __COLOR)) - win->lines[y]->line[x].battr |= __default_color; + for (x = 0; x < win->maxx; x++) { + win->lines[y]->line[x].attr &= ~__COLOR; + win->lines[y]->line[x].attr |= __default_color; + } } __touchwin(win); } @@ -640,8 +633,7 @@ __change_pair(short pair) win = wlp->winp; if (win == __virtscr) continue; - - if (win == curscr) { + else if (win == curscr) { /* Reset colour attribute on curscr */ #ifdef DEBUG __CTRACE("__change_pair: win == curscr\n"); @@ -651,35 +643,32 @@ __change_pair(short pair) for (x = 0; x < curscr->maxx; x++) { if ((lp->line[x].attr & __COLOR) == cl) lp->line[x].attr &= ~__COLOR; - if ((lp->line[x].battr & __COLOR) == cl) - lp->line[x].battr &= ~__COLOR; } } - continue; - } - - /* Mark dirty those positions with colour pair "pair" */ - for (y = 0; y < win->maxy; y++) { - lp = curscr->lines[y]; - for (x = 0; x < win->maxx; x++) - if ((lp->line[x].attr & __COLOR) == cl || - (lp->line[x].battr & __COLOR) == cl) { - if (!(lp->flags & __ISDIRTY)) - lp->flags |= __ISDIRTY; - /* - * firstchp/lastchp are shared - * between parent window and - * sub-window. - */ - if (*lp->firstchp > x) + } else { + /* Mark dirty those positions with colour pair "pair" */ + for (y = 0; y < win->maxy; y++) { + lp = curscr->lines[y]; + for (x = 0; x < win->maxx; x++) + if ((lp->line[x].attr & + __COLOR) == cl) { + if (!(lp->flags & __ISDIRTY)) + lp->flags |= __ISDIRTY; + /* + * firstchp/lastchp are shared + * between parent window and + * sub-window. + */ + if (*lp->firstchp > x) *lp->firstchp = x; - if (*lp->lastchp < x) - *lp->lastchp = x; - } + if (*lp->lastchp < x) + *lp->lastchp = x; + } #ifdef DEBUG - if ((win->lines[y]->flags & __ISDIRTY)) - __CTRACE("__change_pair: first = %d, last = %d\n", *win->lines[y]->firstchp, *win->lines[y]->lastchp); + if ((win->lines[y]->flags & __ISDIRTY)) + __CTRACE("__change_pair: first = %d, last = %d\n", *win->lines[y]->firstchp, *win->lines[y]->lastchp); #endif + } } } } diff --git a/lib/libcurses/curses_background.3 b/lib/libcurses/curses_background.3 index fe246ae52d2e..94f5df8efe1b 100644 --- a/lib/libcurses/curses_background.3 +++ b/lib/libcurses/curses_background.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: curses_background.3,v 1.3 2003/04/16 13:35:00 wiz Exp $ +.\" $NetBSD: curses_background.3,v 1.4 2006/01/15 11:43:54 jdc Exp $ .\" Copyright (c) 2002 The NetBSD Foundation, Inc. .\" All rights reserved. .\" @@ -65,14 +65,33 @@ sets the background attributes of the specified window to .Fa ch . .Pp +When the background attributes are set on a window, characters are added to +the window with the logical +.Em OR +of the background attributes and the character's attributes. +If both the background attribute and the character attribute contain color, +the color of the character attribute is rendered. +If the background attribute contains a non-space character, then this +character is added where the foreground character is a space character. +.Pp +Note that subwindows created from +.Fa win +inherit the background attributes of +.Fa win . +.Pp The function .Fn wbkgd win ch sets the background attributes of the specified window .Fa win to .Fa ch -and also sets the background attribute of every character position on that -window. +and also sets the rendition of every character position on that window, +as if the characters had been newly added to +.Fa win . +The rendition of characters on subwindows of +.Fa win +is also set to +.Fa ch . .Pp The functions .Fn bkgdset ch @@ -84,15 +103,6 @@ and .Fn wbkgd stdscr ch , respectively. .Pp -When the background attributes are set on a window, characters are rendered -with the logical -.Em OR -of the background attributes and the character's attributes. -If both the background attribute and the character attribute contain color, -the color of the character attribute is displayed. -If the background attribute contains a non-space character, then this -character is rendered where the foreground character is a space character. -.Pp The function .Fn getbkgd win returns the background attributes for the window @@ -105,7 +115,8 @@ and return OK on success and ERR on failure. .Sh SEE ALSO .Xr curses_attributes 3 , -.Xr curses_color 3 +.Xr curses_color 3 , +.Xr curses_window .Sh STANDARDS The .Nx diff --git a/lib/libcurses/curses_private.h b/lib/libcurses/curses_private.h index 912b2b36f795..ab052fe03366 100644 --- a/lib/libcurses/curses_private.h +++ b/lib/libcurses/curses_private.h @@ -1,4 +1,4 @@ -/* $NetBSD: curses_private.h,v 1.37 2005/02/18 22:16:27 dsl Exp $ */ +/* $NetBSD: curses_private.h,v 1.38 2006/01/15 11:43:54 jdc Exp $ */ /*- * Copyright (c) 1998-2000 Brett Lymn @@ -73,8 +73,6 @@ extern char *__tc_ac, *__tc_AB, *__tc_ae, *__tc_AF, *__tc_AL, struct __ldata { wchar_t ch; /* Character */ attr_t attr; /* Attributes */ - wchar_t bch; /* Background character */ - attr_t battr; /* Background attributes */ }; #define __LDATASIZE (sizeof(__LDATA)) diff --git a/lib/libcurses/delch.c b/lib/libcurses/delch.c index ab8064b09904..20e7a60c2306 100644 --- a/lib/libcurses/delch.c +++ b/lib/libcurses/delch.c @@ -1,4 +1,4 @@ -/* $NetBSD: delch.c,v 1.17 2004/01/20 08:28:26 wiz Exp $ */ +/* $NetBSD: delch.c,v 1.18 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)delch.c 8.2 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: delch.c,v 1.17 2004/01/20 08:28:26 wiz Exp $"); +__RCSID("$NetBSD: delch.c,v 1.18 2006/01/15 11:43:54 jdc Exp $"); #endif #endif /* not lint */ @@ -96,9 +96,7 @@ wdelch(WINDOW *win) temp1++, temp2++; } temp1->ch = ' '; - temp1->bch = win->bch; temp1->attr = 0; - temp1->battr = win->battr; __touchline(win, (int) win->cury, (int) win->curx, (int) win->maxx - 1); return (OK); } diff --git a/lib/libcurses/erase.c b/lib/libcurses/erase.c index 9d1df93a0d0a..9cb10e7c2d5d 100644 --- a/lib/libcurses/erase.c +++ b/lib/libcurses/erase.c @@ -1,4 +1,4 @@ -/* $NetBSD: erase.c,v 1.18 2005/07/27 20:17:42 jdc Exp $ */ +/* $NetBSD: erase.c,v 1.19 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)erase.c 8.2 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: erase.c,v 1.18 2005/07/27 20:17:42 jdc Exp $"); +__RCSID("$NetBSD: erase.c,v 1.19 2006/01/15 11:43:54 jdc Exp $"); #endif #endif /* not lint */ @@ -65,20 +65,22 @@ werase(WINDOW *win) int y; __LDATA *sp, *end, *start; + attr_t attr; #ifdef DEBUG __CTRACE("werase: (%p)\n", win); #endif + if (__using_color && win != curscr) + attr = __default_color; + else + attr = 0; for (y = 0; y < win->maxy; y++) { start = win->lines[y]->line; end = &start[win->maxx]; for (sp = start; sp < end; sp++) - if (sp->ch != ' ' || sp->attr != 0 || - sp->bch != win->bch || sp->battr != win->battr) { + if (sp->ch != ' ' || sp->attr != 0) { sp->ch = ' '; - sp->bch = win->bch; - sp->attr = 0; - sp->battr = win->battr; + sp->attr = attr; } } /* diff --git a/lib/libcurses/insch.c b/lib/libcurses/insch.c index 0da69d3dde13..b56ef6fd5856 100644 --- a/lib/libcurses/insch.c +++ b/lib/libcurses/insch.c @@ -1,4 +1,4 @@ -/* $NetBSD: insch.c,v 1.17 2003/08/07 16:44:22 agc Exp $ */ +/* $NetBSD: insch.c,v 1.18 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)insch.c 8.2 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: insch.c,v 1.17 2003/08/07 16:44:22 agc Exp $"); +__RCSID("$NetBSD: insch.c,v 1.18 2006/01/15 11:43:54 jdc Exp $"); #endif #endif /* not lint */ @@ -89,7 +89,12 @@ winsch(WINDOW *win, chtype ch) { __LDATA *end, *temp1, *temp2; + attr_t attr; + if (__using_color) + attr = __default_color; + else + attr = 0; end = &win->lines[win->cury]->line[win->curx]; temp1 = &win->lines[win->cury]->line[win->maxx - 1]; temp2 = temp1 - 1; @@ -98,15 +103,17 @@ winsch(WINDOW *win, chtype ch) temp1--, temp2--; } temp1->ch = (wchar_t) ch & __CHARTEXT; - temp1->bch = win->bch; + if (temp1->ch == ' ') + temp1->ch = win->bch; temp1->attr = (attr_t) ch & __ATTRIBUTES; - temp1->battr = win->battr; + if (temp1->attr & __COLOR) + temp1->attr |= (win->bch & ~__COLOR); + else + temp1->attr |= win->bch; __touchline(win, (int) win->cury, (int) win->curx, (int) win->maxx - 1); if (win->cury == LINES - 1 && (win->lines[LINES - 1]->line[COLS - 1].ch != ' ' || - win->lines[LINES - 1]->line[COLS - 1].bch != ' ' || - win->lines[LINES - 1]->line[COLS - 1].attr != 0 || - win->lines[LINES - 1]->line[COLS - 1].battr != 0)) { + win->lines[LINES - 1]->line[COLS - 1].attr != attr)) { if (win->flags & __SCROLLOK) { wrefresh(win); scroll(win); diff --git a/lib/libcurses/insdelln.c b/lib/libcurses/insdelln.c index 29d69820610e..b9991c96ef1d 100644 --- a/lib/libcurses/insdelln.c +++ b/lib/libcurses/insdelln.c @@ -1,4 +1,4 @@ -/* $NetBSD: insdelln.c,v 1.10 2003/07/29 16:42:55 dsl Exp $ */ +/* $NetBSD: insdelln.c,v 1.11 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: insdelln.c,v 1.10 2003/07/29 16:42:55 dsl Exp $"); +__RCSID("$NetBSD: insdelln.c,v 1.11 2006/01/15 11:43:54 jdc Exp $"); #endif /* not lint */ /* @@ -113,9 +113,7 @@ winsdelln(WINDOW *win, int lines) for (y = win->cury - 1 + lines; y >= win->cury; --y) for (i = 0; i < win->maxx; i++) { win->lines[y]->line[i].ch = ' '; - win->lines[y]->line[i].bch = win->bch; win->lines[y]->line[i].attr = 0; - win->lines[y]->line[i].battr = win->battr; } for (y = last; y >= win->cury; --y) __touchline(win, y, 0, (int) win->maxx - 1); @@ -149,9 +147,7 @@ winsdelln(WINDOW *win, int lines) for (y = last - lines; y < last; y++) for (i = 0; i < win->maxx; i++) { win->lines[y]->line[i].ch = ' '; - win->lines[y]->line[i].bch = win->bch; win->lines[y]->line[i].attr = 0; - win->lines[y]->line[i].battr = win->battr; } for (y = win->cury; y < last; y++) __touchline(win, y, 0, (int) win->maxx - 1); diff --git a/lib/libcurses/newwin.c b/lib/libcurses/newwin.c index 5bb4bd51557b..21cc26027f93 100644 --- a/lib/libcurses/newwin.c +++ b/lib/libcurses/newwin.c @@ -1,4 +1,4 @@ -/* $NetBSD: newwin.c,v 1.42 2004/03/28 08:58:37 jdc Exp $ */ +/* $NetBSD: newwin.c,v 1.43 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94"; #else -__RCSID("$NetBSD: newwin.c,v 1.42 2004/03/28 08:58:37 jdc Exp $"); +__RCSID("$NetBSD: newwin.c,v 1.43 2006/01/15 11:43:54 jdc Exp $"); #endif #endif /* not lint */ @@ -132,6 +132,11 @@ __newwin(SCREEN *screen, int nlines, int ncols, int by, int bx, int ispad) if ((win = __makenew(screen, maxy, maxx, by, bx, 0, ispad)) == NULL) return (NULL); + win->bch = ' '; + if (__using_color) + win->battr = __default_color; + else + win->battr = 0; win->nextp = win; win->ch_off = 0; win->orig = NULL; @@ -150,12 +155,7 @@ __newwin(SCREEN *screen, int nlines, int ncols, int by, int bx, int ispad) lp->flags = 0; for (sp = lp->line, j = 0; j < maxx; j++, sp++) { sp->ch = ' '; - sp->bch = ' '; sp->attr = 0; - if (__using_color) - sp->battr = __default_color; - else - sp->battr = 0; } lp->hash = __hash((char *)(void *)lp->line, (size_t) (ncols * __LDATASIZE)); @@ -195,6 +195,8 @@ __subwin(WINDOW *orig, int nlines, int ncols, int by, int bx, int ispad) if ((win = __makenew(_cursesi_screen, maxy, maxx, by, bx, 1, ispad)) == NULL) return (NULL); + win->bch = orig->bch; + win->battr = orig->battr; win->reqy = nlines; win->reqx = ncols; win->nextp = orig->nextp; @@ -341,11 +343,6 @@ __makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub, win->flags = (__IDLINE | __IDCHAR); win->delay = -1; win->wattr = 0; - win->bch = ' '; - if (__using_color) - win->battr = __default_color; - else - win->battr = 0; win->scr_t = 0; win->scr_b = win->maxy - 1; if (ispad) { @@ -365,8 +362,6 @@ __makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub, __CTRACE("makenew: win->maxx = %d\n", win->maxx); __CTRACE("makenew: win->begy = %d\n", win->begy); __CTRACE("makenew: win->begx = %d\n", win->begx); - __CTRACE("makenew: win->bch = %s\n", unctrl(win->bch)); - __CTRACE("makenew: win->battr = %08x\n", win->battr); __CTRACE("makenew: win->scr_t = %d\n", win->scr_t); __CTRACE("makenew: win->scr_b = %d\n", win->scr_b); #endif diff --git a/lib/libcurses/refresh.c b/lib/libcurses/refresh.c index cc1b1435a3bd..cfbda51d061a 100644 --- a/lib/libcurses/refresh.c +++ b/lib/libcurses/refresh.c @@ -1,4 +1,4 @@ -/* $NetBSD: refresh.c,v 1.62 2005/10/23 18:38:52 dsl Exp $ */ +/* $NetBSD: refresh.c,v 1.63 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94"; #else -__RCSID("$NetBSD: refresh.c,v 1.62 2005/10/23 18:38:52 dsl Exp $"); +__RCSID("$NetBSD: refresh.c,v 1.63 2006/01/15 11:43:54 jdc Exp $"); #endif #endif /* not lint */ @@ -220,27 +220,15 @@ _cursesi_wnoutrefresh(SCREEN *screen, WINDOW *win, int begy, int begx, __CTRACE("_wnoutrefresh: copy from %d, %d to %d, %d\n", wy, wx, y_off, x_off); #endif + /* Copy character */ + vlp->line[x_off].ch = wlp->line[wx].ch; + /* Copy attributes */ vlp->line[x_off].attr = wlp->line[wx].attr; - /* Copy attributes */ - if (wlp->line[wx].attr & __COLOR) - vlp->line[x_off].attr |= - wlp->line[wx].battr & ~__COLOR; - else - vlp->line[x_off].attr |= - wlp->line[wx].battr; /* Check for nca conflict with colour */ if ((vlp->line[x_off].attr & __COLOR) && (vlp->line[x_off].attr & _cursesi_screen->nca)) vlp->line[x_off].attr &= ~__COLOR; - /* Copy character */ - if (wlp->line[wx].ch == ' ' && - wlp->line[wx].bch != ' ') - vlp->line[x_off].ch - = wlp->line[wx].bch; - else - vlp->line[x_off].ch - = wlp->line[wx].ch; wx++; x_off++; } @@ -530,7 +518,7 @@ makech(wy) int wy; { WINDOW *win; - static __LDATA blank = {' ', 0, ' ', 0}; + static __LDATA blank = {' ', 0}; __LDATA *nsp, *csp, *cp, *cep; int clsp, nlsp; /* Last space in lines. */ int lch, wx; @@ -1001,9 +989,7 @@ done: if (buf[0].ch != ' ') { for (i = 0; i < BLANKSIZE; i++) { buf[i].ch = ' '; - buf[i].bch = ' '; buf[i].attr = 0; - buf[i].battr = 0; } } diff --git a/lib/libcurses/resize.c b/lib/libcurses/resize.c index b865cf4d26b3..e88c52fcfde6 100644 --- a/lib/libcurses/resize.c +++ b/lib/libcurses/resize.c @@ -1,4 +1,4 @@ -/* $NetBSD: resize.c,v 1.11 2004/04/29 22:28:51 christos Exp $ */ +/* $NetBSD: resize.c,v 1.12 2006/01/15 11:43:54 jdc Exp $ */ /* * Copyright (c) 2001 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)resize.c blymn 2001/08/26"; #else -__RCSID("$NetBSD: resize.c,v 1.11 2004/04/29 22:28:51 christos Exp $"); +__RCSID("$NetBSD: resize.c,v 1.12 2006/01/15 11:43:54 jdc Exp $"); #endif #endif /* not lint */ @@ -258,9 +258,7 @@ __resizewin(WINDOW *win, int nlines, int ncols) lp = win->lines[i]; for (sp = lp->line, j = 0; j < win->maxx; j++, sp++) { sp->ch = ' '; - sp->bch = ' '; sp->attr = 0; - sp->battr = 0; } lp->hash = __hash((char *)(void *)lp->line, (size_t) (ncols * __LDATASIZE));