copy the last line to the next to last, too
[unix-history] / usr / src / lib / libcurses / scroll.c
CommitLineData
064c6fd5
KA
1# include "curses.ext"
2
3/*
4 * This routine scrolls the window up a line.
5 *
ef430c4c 6 * %G% (Berkeley) @(#)scroll.c 1.3
064c6fd5
KA
7 */
8scroll(win)
9reg WINDOW *win; {
10
11 reg char *sp;
12 reg int i;
13 reg char *temp;
14
15 if (!win->_scroll)
16 return ERR;
17 temp = win->_y[0];
ef430c4c
KA
18 for (i = 1; i < win->_maxy; i++)
19 win->_y[i - 1] = win->_y[i];
20 for (sp = temp; sp < &temp[win->_maxx]; )
064c6fd5
KA
21 *sp++ = ' ';
22 win->_y[win->_maxy - 1] = temp;
23 win->_cury--;
24 if (win == curscr) {
25 putchar('\n');
26 if (!NONL)
27 win->_curx = 0;
28# ifdef DEBUG
29 fprintf(outf, "SCROLL: win == curscr\n");
30# endif
31 }
32# ifdef DEBUG
33 else
34 fprintf(outf, "SCROLL: win [0%o] != curscr [0%o]\n",win,curscr);
35# endif
ef430c4c 36 touchwin(win);
064c6fd5
KA
37 return OK;
38}