1 /* Public Domain Curses */
5 RCSID("$Id: deleteln.c,v 1.35 2008/07/13 16:08:18 wmcbrine Exp $")
7 /*man-start**************************************************************
13 int wdeleteln(WINDOW *win);
15 int winsdelln(WINDOW *win, int n);
17 int winsertln(WINDOW *win);
19 int mvdeleteln(int y, int x);
20 int mvwdeleteln(WINDOW *win, int y, int x);
21 int mvinsertln(int y, int x);
22 int mvwinsertln(WINDOW *win, int y, int x);
25 With the deleteln() and wdeleteln() functions, the line under
26 the cursor in the window is deleted. All lines below the
27 current line are moved up one line. The bottom line of the
28 window is cleared. The cursor position does not change.
30 With the insertln() and winsertn() functions, a blank line is
31 inserted above the current line and the bottom line is lost.
33 mvdeleteln(), mvwdeleteln(), mvinsertln() and mvwinsertln()
34 allow moving the cursor and inserting/deleting in one call.
37 All functions return OK on success and ERR on error.
39 Portability X/Open BSD SYS V
51 **man-end****************************************************************/
53 int wdeleteln(WINDOW
*win
)
55 chtype blank
, *temp
, *ptr
;
58 PDC_LOG(("wdeleteln() - called\n"));
63 /* wrs (4/10/93) account for window background */
67 temp
= win
->_y
[win
->_cury
];
69 for (y
= win
->_cury
; y
< win
->_bmarg
; y
++)
71 win
->_y
[y
] = win
->_y
[y
+ 1];
73 win
->_lastch
[y
] = win
->_maxx
- 1;
76 for (ptr
= temp
; (ptr
- temp
< win
->_maxx
); ptr
++)
77 *ptr
= blank
; /* make a blank line */
79 if (win
->_cury
<= win
->_bmarg
)
81 win
->_firstch
[win
->_bmarg
] = 0;
82 win
->_lastch
[win
->_bmarg
] = win
->_maxx
- 1;
83 win
->_y
[win
->_bmarg
] = temp
;
91 PDC_LOG(("deleteln() - called\n"));
93 return wdeleteln(stdscr
);
96 int mvdeleteln(int y
, int x
)
98 PDC_LOG(("mvdeleteln() - called\n"));
100 if (move(y
, x
) == ERR
)
103 return wdeleteln(stdscr
);
106 int mvwdeleteln(WINDOW
*win
, int y
, int x
)
108 PDC_LOG(("mvwdeleteln() - called\n"));
110 if (wmove(win
, y
, x
) == ERR
)
113 return wdeleteln(win
);
116 int winsdelln(WINDOW
*win
, int n
)
120 PDC_LOG(("winsdelln() - called\n"));
127 for (i
= 0; i
< n
; i
++)
128 if (winsertln(win
) == ERR
)
134 for (i
= 0; i
< n
; i
++)
135 if (wdeleteln(win
) == ERR
)
144 PDC_LOG(("insdelln() - called\n"));
146 return winsdelln(stdscr
, n
);
149 int winsertln(WINDOW
*win
)
151 chtype blank
, *temp
, *end
;
154 PDC_LOG(("winsertln() - called\n"));
159 /* wrs (4/10/93) account for window background */
163 temp
= win
->_y
[win
->_maxy
- 1];
165 for (y
= win
->_maxy
- 1; y
> win
->_cury
; y
--)
167 win
->_y
[y
] = win
->_y
[y
- 1];
168 win
->_firstch
[y
] = 0;
169 win
->_lastch
[y
] = win
->_maxx
- 1;
172 win
->_y
[win
->_cury
] = temp
;
174 for (end
= &temp
[win
->_maxx
- 1]; temp
<= end
; temp
++)
177 win
->_firstch
[win
->_cury
] = 0;
178 win
->_lastch
[win
->_cury
] = win
->_maxx
- 1;
185 PDC_LOG(("insertln() - called\n"));
187 return winsertln(stdscr
);
190 int mvinsertln(int y
, int x
)
192 PDC_LOG(("mvinsertln() - called\n"));
194 if (move(y
, x
) == ERR
)
197 return winsertln(stdscr
);
200 int mvwinsertln(WINDOW
*win
, int y
, int x
)
202 PDC_LOG(("mvwinsertln() - called\n"));
204 if (wmove(win
, y
, x
) == ERR
)
207 return winsertln(win
);