Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcurses Don't reset firstchp and lastchp even if this ...



details:   https://anonhg.NetBSD.org/src/rev/d8210de5b010
branches:  trunk
changeset: 484963:d8210de5b010
user:      jdc <jdc%NetBSD.org@localhost>
date:      Sat Apr 15 22:53:05 2000 +0000

description:
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.

diffstat:

 lib/libcurses/addbytes.c |  21 +++++++++++----------
 lib/libcurses/color.c    |  25 +++++++++++--------------
 lib/libcurses/touchwin.c |  15 ++++++---------
 3 files changed, 28 insertions(+), 33 deletions(-)

diffs (129 lines):

diff -r 464b097d3e62 -r d8210de5b010 lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c  Sat Apr 15 22:05:51 2000 +0000
+++ b/lib/libcurses/addbytes.c  Sat Apr 15 22:53:05 2000 +0000
@@ -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 @@
                        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,
diff -r 464b097d3e62 -r d8210de5b010 lib/libcurses/color.c
--- a/lib/libcurses/color.c     Sat Apr 15 22:05:51 2000 +0000
+++ b/lib/libcurses/color.c     Sat Apr 15 22:53:05 2000 +0000
@@ -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 @@
                                        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
                        }
diff -r 464b097d3e62 -r d8210de5b010 lib/libcurses/touchwin.c
--- a/lib/libcurses/touchwin.c  Sat Apr 15 22:05:51 2000 +0000
+++ b/lib/libcurses/touchwin.c  Sat Apr 15 22:53:05 2000 +0000
@@ -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 @@
                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);



Home | Main Index | Thread Index | Old Index