source: trunk/minix/lib/curses/winscrol.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 2.0 KB
Line 
1/****************************************************************/
2/* Scroll() routine of the PCcurses package */
3/* */
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. */
15/* 900906 */
16/****************************************************************/
17
18#include <curses.h>
19#include "curspriv.h"
20
21/****************************************************************/
22/* Scroll() scrolls the scrolling region of 'win', but only if */
23/* Scrolling is allowed and if the cursor is inside the scrol- */
24/* Ling region. */
25/****************************************************************/
26
27void scroll(win)
28WINDOW *win;
29{
30 int i;
31 int *ptr;
32 int *temp;
33 static int blank;
34
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)
39 )
40 return;
41
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 */
45 win->_minchng[i] = 0;
46 win->_maxchng[i] = win->_maxx;
47 }
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;
55} /* scroll */
Note: See TracBrowser for help on using the repository browser.