Handle both background character and background attribute.

This commit is contained in:
jdc 2006-02-05 17:39:52 +00:00
parent 8b589aee17
commit b7f0401ba9
5 changed files with 31 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: clrtobot.c,v 1.17 2006/01/26 07:26:37 jdc Exp $ */
/* $NetBSD: clrtobot.c,v 1.18 2006/02/05 17:39:52 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.17 2006/01/26 07:26:37 jdc Exp $");
__RCSID("$NetBSD: clrtobot.c,v 1.18 2006/02/05 17:39:52 jdc Exp $");
#endif
#endif /* not lint */
@ -84,11 +84,11 @@ wclrtobot(WINDOW *win)
minx = -1;
end = &win->lines[y]->line[win->maxx];
for (sp = &win->lines[y]->line[startx]; sp < end; sp++)
if (sp->ch != ' ' || sp->attr != attr) {
if (sp->ch != win->bch || sp->attr != attr) {
maxx = sp;
if (minx == -1)
minx = sp - win->lines[y]->line;
sp->ch = ' ';
sp->ch = win->bch;
sp->attr = attr;
}
if (minx != -1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: clrtoeol.c,v 1.20 2006/01/26 07:26:37 jdc Exp $ */
/* $NetBSD: clrtoeol.c,v 1.21 2006/02/05 17:39:52 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.20 2006/01/26 07:26:37 jdc Exp $");
__RCSID("$NetBSD: clrtoeol.c,v 1.21 2006/02/05 17:39:52 jdc Exp $");
#endif
#endif /* not lint */
@ -86,11 +86,11 @@ wclrtoeol(WINDOW *win)
else
attr = 0;
for (sp = maxx; sp < end; sp++)
if (sp->ch != ' ' || sp->attr != attr) {
if (sp->ch != win->bch || sp->attr != attr) {
maxx = sp;
if (minx == -1)
minx = sp - win->lines[y]->line;
sp->ch = ' ';
sp->ch = win->bch;
sp->attr = attr;
}
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: delch.c,v 1.18 2006/01/15 11:43:54 jdc Exp $ */
/* $NetBSD: delch.c,v 1.19 2006/02/05 17:39:52 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.18 2006/01/15 11:43:54 jdc Exp $");
__RCSID("$NetBSD: delch.c,v 1.19 2006/02/05 17:39:52 jdc Exp $");
#endif
#endif /* not lint */
@ -95,8 +95,11 @@ wdelch(WINDOW *win)
(void) memcpy(temp1, temp2, sizeof(__LDATA));
temp1++, temp2++;
}
temp1->ch = ' ';
temp1->attr = 0;
temp1->ch = win->bch;
if (__using_color && win != curscr)
temp1->attr = win->battr & __COLOR;
else
temp1->attr = 0;
__touchline(win, (int) win->cury, (int) win->curx, (int) win->maxx - 1);
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: erase.c,v 1.20 2006/01/26 07:26:37 jdc Exp $ */
/* $NetBSD: erase.c,v 1.21 2006/02/05 17:39:52 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.20 2006/01/26 07:26:37 jdc Exp $");
__RCSID("$NetBSD: erase.c,v 1.21 2006/02/05 17:39:52 jdc Exp $");
#endif
#endif /* not lint */
@ -78,8 +78,8 @@ werase(WINDOW *win)
start = win->lines[y]->line;
end = &start[win->maxx];
for (sp = start; sp < end; sp++)
if (sp->ch != ' ' || sp->attr != 0) {
sp->ch = ' ';
if (sp->ch != win->bch || sp->attr != 0) {
sp->ch = win->bch;
sp->attr = attr;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: insdelln.c,v 1.11 2006/01/15 11:43:54 jdc Exp $ */
/* $NetBSD: insdelln.c,v 1.12 2006/02/05 17:39:52 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.11 2006/01/15 11:43:54 jdc Exp $");
__RCSID("$NetBSD: insdelln.c,v 1.12 2006/02/05 17:39:52 jdc Exp $");
#endif /* not lint */
/*
@ -75,6 +75,7 @@ winsdelln(WINDOW *win, int lines)
{
int y, i, last;
__LINE *temp;
attr_t attr;
#ifdef DEBUG
__CTRACE("winsdelln: (%p) cury=%d lines=%d\n", win, win->cury,
@ -84,6 +85,11 @@ winsdelln(WINDOW *win, int lines)
if (!lines)
return(OK);
if (__using_color && win != curscr)
attr = win->battr & __COLOR;
else
attr = 0;
if (lines > 0) {
/* Insert lines */
if (win->cury < win->scr_t || win->cury > win->scr_b) {
@ -112,8 +118,8 @@ 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].attr = 0;
win->lines[y]->line[i].ch = win->bch;
win->lines[y]->line[i].attr = attr;
}
for (y = last; y >= win->cury; --y)
__touchline(win, y, 0, (int) win->maxx - 1);
@ -146,8 +152,8 @@ 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].attr = 0;
win->lines[y]->line[i].ch = win->bch;
win->lines[y]->line[i].attr = attr;
}
for (y = win->cury; y < last; y++)
__touchline(win, y, 0, (int) win->maxx - 1);