xref: /original-bsd/lib/libcurses/deleteln.c (revision 860e07fc)
1 /*
2  * Copyright (c) 1981 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)deleteln.c	5.7 (Berkeley) 08/23/92";
10 #endif	/* not lint */
11 
12 #include <curses.h>
13 #include <string.h>
14 
15 /*
16  * wdeleteln --
17  *	Delete a line from the screen.  It leaves (_cury, _curx) unchanged.
18  */
19 int
20 wdeleteln(win)
21 	register WINDOW *win;
22 {
23 	register int y;
24 	register char *temp;
25 
26 #ifdef DEBUG
27 	__TRACE("deleteln: (%0.2o)\n", win);
28 #endif
29 	temp = win->_y[win->_cury];
30 	for (y = win->_cury; y < win->_maxy - 1; y++) {
31 		if (win->_orig == NULL)
32 			win->_y[y] = win->_y[y + 1];
33 		else
34 			bcopy(win->_y[y + 1], win->_y[y], win->_maxx);
35 		touchline(win, y, 0, win->_maxx - 1);
36 	}
37 	if (win->_orig == NULL)
38 		win->_y[y] = temp;
39 	else
40 		temp = win->_y[y];
41 	(void)memset(temp, ' ', &temp[win->_maxx] - temp);
42 	touchline(win, win->_cury, 0, win->_maxx - 1);
43 	if (win->_orig == NULL)
44 		__id_subwins(win);
45 	return (OK);
46 }
47