]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_redrawln.c
ncurses 5.0
[ncurses.git] / ncurses / base / lib_redrawln.c
similarity index 80%
rename from ncurses/lib_redrawln.c
rename to ncurses/base/lib_redrawln.c
index adcdf73632f6ff5702c077349bcc6178c9483a74..10fda917984e38c520c101a55c82194953a5130b 100644 (file)
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_redrawln.c,v 1.2 1998/02/11 12:13:57 tom Exp $")
+MODULE_ID("$Id: lib_redrawln.c,v 1.7 1998/09/19 20:09:50 Alexander.V.Lukyanov Exp $")
 
 int wredrawln(WINDOW *win, int beg, int num)
 {
-int i;
+       int i;
+       int end;
+       size_t len = (win->_maxx + 1) * sizeof(chtype);
 
        T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num));
 
-       if (touchline(win, beg, num) == OK) {
-               size_t len = win->_maxx * sizeof(chtype);
+       if (beg < 0)
+               beg = 0;
 
-               /*
-                * XSI says that wredrawln() tells the library not to base
-                * optimization on the contents of the lines that are marked.
-                * We do that by changing the contents to nulls after touching
-                * the corresponding lines to get the optimizer's attention.
-                *
-                * FIXME: this won't work if the application makes further
-                * updates before the next refresh.
-                */
-               for (i = beg; (i < beg + num) && (i < win->_maxy); i++) {
-                       memset(win->_line[i].text, 0, len);
-               }
+       if (touchline (win, beg, num) == ERR)
+               returnCode(ERR);
+
+       end = beg + num;
+       if (end > win->_maxy + 1)
+               end = win->_maxy + 1;
+
+       for (i = beg; i < end; i++)
+       {
+               memset (curscr->_line[i+win->_begy].text+win->_begx, 0, len);
+               _nc_make_oldhash(i+win->_begy);
        }
+
        returnCode(OK);
 }