X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_redrawln.c;fp=ncurses%2Flib_redrawln.c;h=10fda917984e38c520c101a55c82194953a5130b;hp=adcdf73632f6ff5702c077349bcc6178c9483a74;hb=refs%2Ftags%2Fv5.0;hpb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1 diff --git a/ncurses/lib_redrawln.c b/ncurses/base/lib_redrawln.c similarity index 80% rename from ncurses/lib_redrawln.c rename to ncurses/base/lib_redrawln.c index adcdf736..10fda917 100644 --- a/ncurses/lib_redrawln.c +++ b/ncurses/base/lib_redrawln.c @@ -39,29 +39,31 @@ #include -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); }