xref: /original-bsd/lib/libcurses/deleteln.c (revision be1f24e8)
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.10 (Berkeley) 10/01/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 LINE *temp;
25 
26 #ifdef DEBUG
27 	__TRACE("deleteln: (%0.2o)\n", win);
28 #endif
29 	temp = win->lines[win->cury];
30 	for (y = win->cury; y < win->maxy - 1; y++) {
31 		win->lines[y]->flags &= ~__ISPASTEOL;
32 		win->lines[y + 1]->flags &= ~__ISPASTEOL;
33 		if (win->orig == NULL)
34 			win->lines[y] = win->lines[y + 1];
35 		else
36 			bcopy(win->lines[y + 1]->line, win->lines[y]->line,
37 			      win->maxx);
38 		touchline(win, y, 0, win->maxx - 1);
39 	}
40 
41 	if (win->orig == NULL)
42 		win->lines[y] = temp;
43 	else
44 		temp = win->lines[y];
45 
46 	(void)memset(temp->line, ' ', &temp->line[win->maxx] - temp->line);
47 	touchline(win, y, 0, win->maxx - 1);
48 	if (win->orig == NULL)
49 		__id_subwins(win);
50 	return (OK);
51 }
52