- if (smaxrow > screen_lines
- || smaxcol > screen_columns
- || sminrow > smaxrow
- || smincol > smaxcol)
- returnCode(ERR);
-
- T(("pad being refreshed"));
-
- if (win->_pad._pad_y >= 0) {
- displaced = pminrow - win->_pad._pad_y
- -(sminrow - win->_pad._pad_top);
- T(("pad being shifted by %d line(s)", displaced));
- } else
- displaced = 0;
-
- /*
- * For pure efficiency, we'd want to transfer scrolling information
- * from the pad to newscr whenever the window is wide enough that
- * its update will dominate the cost of the update for the horizontal
- * band of newscr that it occupies. Unfortunately, this threshold
- * tends to be complex to estimate, and in any case scrolling the
- * whole band and rewriting the parts outside win's image would look
- * really ugly. So. What we do is consider the pad "wide" if it
- * either (a) occupies the whole width of newscr, or (b) occupies
- * all but at most one column on either vertical edge of the screen
- * (this caters to fussy people who put boxes around full-screen
- * windows). Note that changing this formula will not break any code,
- * merely change the costs of various update cases.
- */
- wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len));
-
- for (i = pminrow, m = sminrow + win->_yoffset;
- i <= pmaxrow && m <= newscr->_maxy;
- i++, m++) {
- register struct ldat *nline = &newscr->_line[m];
- register struct ldat *oline = &win->_line[i];
-
- for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) {
- if (oline->text[j] != nline->text[n]) {
- nline->text[n] = oline->text[j];
- CHANGED_CELL(nline,n);
- }
- }