summaryrefslogtreecommitdiff
path: root/lib/libcurses/addbytes.c
diff options
context:
space:
mode:
authorjdc <jdc@NetBSD.org>2006-01-15 11:43:54 +0000
committerjdc <jdc@NetBSD.org>2006-01-15 11:43:54 +0000
commit978ab4ad4e6c7fa0190bb76ee3697b2ec6c408ab (patch)
treeb0b039abfbe5bde00b43fff37d5eb1475fe0bfd1 /lib/libcurses/addbytes.c
parentd0cbf72e2a7425ccef5a5a88d0b2dc547c65f9e2 (diff)
Background characters and attributes don't need to be kept per character
cell, as they are merged when characters are added. Remove the per cell storage and clarify the manual page. Pointed out by ruibiao@.
Diffstat (limited to 'lib/libcurses/addbytes.c')
-rw-r--r--lib/libcurses/addbytes.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c
index 934c16e80d8..a3ccb1bb691 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