]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_refresh.c
ncurses 5.0
[ncurses.git] / ncurses / base / lib_refresh.c
similarity index 89%
rename from ncurses/lib_refresh.c
rename to ncurses/base/lib_refresh.c
index 417e670273e5decc4e7d87cc437d5cc935310868..88e3b75a56a1ac195af5f9b5a4b57d7ac2d16028 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_refresh.c,v 1.19 1998/02/11 12:13:59 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.24 1999/07/31 11:36:37 juergen Exp $")
 
 int wrefresh(WINDOW *win)
 {
@@ -70,6 +70,7 @@ int code;
 
 int wnoutrefresh(WINDOW *win)
 {
+short  limit_x;
 short  i, j;
 short  begx;
 short  begy;
@@ -93,14 +94,7 @@ bool wide;
        begx = win->_begx;
        begy = win->_begy;
 
-       /*
-        * If 'newscr' has a different background than the window that we're
-        * trying to refresh, we'll have to copy the whole thing.
-        */
-       if (win->_bkgd != newscr->_bkgd) {
-               touchwin(win);
-               newscr->_bkgd = win->_bkgd;
-       }
+       newscr->_bkgd  = win->_bkgd;
        newscr->_attrs = win->_attrs;
 
        /* merge in change information from all subwindows of this window */
@@ -130,6 +124,13 @@ bool       wide;
         * common-subexpression chunking to make it really tense,
         * so we'll force the issue.
         */
+
+       /* limit(n) */
+       limit_x = win->_maxx;
+       /* limit(j) */
+       if (limit_x > win->_maxx)
+               limit_x = win->_maxx;
+
        for (i = 0, m = begy + win->_yoffset;
             i <= win->_maxy && m <= newscr->_maxy;
             i++, m++) {
@@ -139,23 +140,13 @@ bool      wide;
                if (oline->firstchar != _NOCHANGE) {
                        int last = oline->lastchar;
 
-                       /* limit(j) */
-                       if (last > win->_maxx)
-                               last = win->_maxx;
-                       /* limit(n) */
-                       if (last > newscr->_maxx - begx)
-                               last = newscr->_maxx - begx;
+                       if (last > limit_x)
+                               last = limit_x;
 
                        for (j = oline->firstchar, n = j + begx; j <= last; j++, n++) {
                                if (oline->text[j] != nline->text[n]) {
                                        nline->text[n] = oline->text[j];
-
-                                       if (nline->firstchar == _NOCHANGE)
-                                               nline->firstchar = nline->lastchar = n;
-                                       else if (n < nline->firstchar)
-                                               nline->firstchar = n;
-                                       else if (n > nline->lastchar)
-                                               nline->lastchar = n;
+                                       CHANGED_CELL(nline, n);
                                }
                        }
 
@@ -182,6 +173,8 @@ bool        wide;
                newscr->_cury = win->_cury + win->_begy + win->_yoffset;
                newscr->_curx = win->_curx + win->_begx;
        }
+       newscr->_leaveok = win->_leaveok;
+       
 #ifdef TRACE
        if (_nc_tracing & TRACE_UPDATE)
            _tracedump("newscr", newscr);