Don't reset firstchp and lastchp even if this line was not dirty.

They could have been set previously by a parent window or sub-window.
This commit is contained in:
jdc 2000-04-15 22:53:05 +00:00
parent c56a43535d
commit 8e3f558953
3 changed files with 28 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: addbytes.c,v 1.17 2000/04/15 13:17:02 blymn Exp $ */
/* $NetBSD: addbytes.c,v 1.18 2000/04/15 22:53:05 jdc Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: addbytes.c,v 1.17 2000/04/15 13:17:02 blymn Exp $");
__RCSID("$NetBSD: addbytes.c,v 1.18 2000/04/15 22:53:05 jdc Exp $");
#endif
#endif /* not lint */
@ -179,15 +179,16 @@ __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
if (lp->line[x].ch != c ||
lp->line[x].attr != attributes) {
newx = x + win->ch_off;
if (!(lp->flags & __ISDIRTY)) {
if (!(lp->flags & __ISDIRTY))
lp->flags |= __ISDIRTY;
*lp->firstchp = *lp->lastchp = newx;
} else
if (newx < *lp->firstchp)
*lp->firstchp = newx;
else
if (newx > *lp->lastchp)
*lp->lastchp = newx;
/*
* firstchp/lastchp are shared between
* parent window and sub-window.
*/
if (newx < *lp->firstchp)
*lp->firstchp = newx;
if (newx > *lp->lastchp)
*lp->lastchp = newx;
#ifdef DEBUG
__CTRACE("ADDBYTES: change gives f/l: %d/%d [%d/%d]\n",
*lp->firstchp, *lp->lastchp,

View File

@ -1,4 +1,4 @@
/* $NetBSD: color.c,v 1.3 2000/04/15 13:17:03 blymn Exp $ */
/* $NetBSD: color.c,v 1.4 2000/04/15 22:53:05 jdc Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -400,27 +400,24 @@ __change_pair(short pair)
if ((win->lines[y]->line[x].attr &
__COLOR) == COLOR_PAIR(pair)) {
if (!(win->lines[y]->flags &
__ISDIRTY)) {
__ISDIRTY))
win->lines[y]->flags |=
__ISDIRTY;
/*
* firstchp/lastchp are shared
* between parent window and
* sub-window.
*/
if (*win->lines[y]->firstchp >
x)
*win->lines[y]->firstchp
= x;
if (*win->lines[y]->lastchp < x)
*win->lines[y]->lastchp
= x;
} else {
if (*win->lines[y]->
firstchp > x)
*win->lines[y]->
firstchp =
x;
if (*win->lines[y]->
lastchp < x)
*win->lines[y]->
lastchp = x;
}
}
#ifdef DEBUG
if ((win->lines[y]->flags & __ISDIRTY)
if ((win->lines[y]->flags & __ISDIRTY))
__CTRACE("__change_pair: first = %d, last = %d\n", *win->lines[y]->firstchp, *win->lines[y]->lastchp);
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: touchwin.c,v 1.11 2000/04/15 13:17:05 blymn Exp $ */
/* $NetBSD: touchwin.c,v 1.12 2000/04/15 22:53:05 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)touchwin.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: touchwin.c,v 1.11 2000/04/15 13:17:05 blymn Exp $");
__RCSID("$NetBSD: touchwin.c,v 1.12 2000/04/15 22:53:05 jdc Exp $");
#endif
#endif /* not lint */
@ -107,16 +107,13 @@ __touchline(WINDOW *win, int y, int sx, int ex, int force)
win->lines[y]->flags |= __FORCEPAINT;
sx += win->ch_off;
ex += win->ch_off;
if (!(win->lines[y]->flags & __ISDIRTY)) {
if (!(win->lines[y]->flags & __ISDIRTY))
win->lines[y]->flags |= __ISDIRTY;
/* firstchp/lastchp are shared between parent window and sub-window. */
if (*win->lines[y]->firstchp > sx)
*win->lines[y]->firstchp = sx;
if (*win->lines[y]->lastchp < ex)
*win->lines[y]->lastchp = ex;
} else {
if (*win->lines[y]->firstchp > sx)
*win->lines[y]->firstchp = sx;
if (*win->lines[y]->lastchp < ex)
*win->lines[y]->lastchp = ex;
}
#ifdef DEBUG
__CTRACE("touchline: first = %d, last = %d\n",
*win->lines[y]->firstchp, *win->lines[y]->lastchp);