1 /* Public Domain Curses */
5 RCSID("$Id: scroll.c,v 1.36 2008/07/13 16:08:18 wmcbrine Exp $")
7 /*man-start**************************************************************
12 int scroll(WINDOW *win);
14 int wscrl(WINDOW *win, int n);
17 scroll() causes the window to scroll up one line. This involves
18 moving the lines in the window data strcture.
20 With a positive n, scrl() and wscrl() scroll the window up n
21 lines (line i + n becomes i); otherwise they scroll the window
24 For these functions to work, scrolling must be enabled via
25 scrollok(). Note also that scrolling is not allowed if the
26 supplied window is a pad.
29 All functions return OK on success and ERR on error.
31 Portability X/Open BSD SYS V
36 **man-end****************************************************************/
38 int wscrl(WINDOW
*win
, int n
)
40 int i
, l
, dir
, start
, end
;
43 /* Check if window scrolls. Valid for window AND pad */
45 if (!win
|| !win
->_scroll
|| !n
)
63 for (l
= 0; l
< (n
* dir
); l
++)
65 temp
= win
->_y
[start
];
67 /* re-arrange line pointers */
69 for (i
= start
; i
!= end
; i
+= dir
)
70 win
->_y
[i
] = win
->_y
[i
+ dir
];
74 /* make a blank line */
76 for (i
= 0; i
< win
->_maxx
; i
++)
80 touchline(win
, win
->_tmarg
, win
->_bmarg
- win
->_tmarg
+ 1);
88 PDC_LOG(("scrl() - called\n"));
90 return wscrl(stdscr
, n
);
93 int scroll(WINDOW
*win
)
95 PDC_LOG(("scroll() - called\n"));