summaryrefslogtreecommitdiff
path: root/lib/libcurses/background.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/background.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/background.c')
-rw-r--r--lib/libcurses/background.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/libcurses/background.c b/lib/libcurses/background.c
index f7ad0673847..b9e2bc24ed7 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);