1 /****************************************************************/
2 /* Scroll() routine of the PCcurses package */
4 /****************************************************************/
5 /* This version of curses is based on ncurses, a curses version */
6 /* Originally written by Pavel Curtis at Cornell University. */
7 /* I have made substantial changes to make it run on IBM PC's, */
8 /* And therefore consider myself free to make it public domain. */
9 /* Bjorn Larsson (...mcvax!enea!infovax!bl) */
10 /****************************************************************/
11 /* 1.0: Release: 870515 */
12 /****************************************************************/
13 /* Modified to run under the MINIX operating system by Don Cope */
14 /* These changes are also released into the public domain. */
16 /****************************************************************/
21 /****************************************************************/
22 /* Scroll() scrolls the scrolling region of 'win', but only if */
23 /* Scrolling is allowed and if the cursor is inside the scrol- */
25 /****************************************************************/
35 blank
= ' ' | (win
->_attrs
& ATR_MSK
);
36 if ((!win
->_scroll
) /* check if window scrolls */
37 ||(win
->_cury
< win
->_regtop
) /* and cursor in region */
38 ||(win
->_cury
> win
->_regbottom
)
42 temp
= win
->_line
[win
->_regtop
];
43 for (i
= win
->_regtop
; i
< win
->_regbottom
; i
++) {
44 win
->_line
[i
] = win
->_line
[i
+ 1]; /* re-arrange line pointers */
46 win
->_maxchng
[i
] = win
->_maxx
;
48 for (ptr
= temp
; ptr
- temp
<= win
->_maxx
; ptr
++)
49 *ptr
= blank
; /* make a blank line */
50 win
->_line
[win
->_regbottom
] = temp
;
51 if (win
->_cury
> win
->_regtop
)/* if not on top line */
52 win
->_cury
--; /* cursor scrolls too */
53 win
->_minchng
[win
->_regbottom
] = 0;
54 win
->_maxchng
[win
->_regbottom
] = win
->_maxx
;