7 * MuCurses clearing functions
11 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
14 * Clear a window to the bottom from current cursor position
16 * @v *win subject window
17 * @ret rc return status code
19 int wclrtobot ( WINDOW *win ) {
20 struct cursor_pos pos;
22 _store_curs_pos( win, &pos );
24 _wputc( win, ' ', WRAP );
25 } while ( win->curs_y + win->curs_x );
26 _restore_curs_pos( win, &pos );
32 * Clear a window to the end of the current line
34 * @v *win subject window
35 * @ret rc return status code
37 int wclrtoeol ( WINDOW *win ) {
38 struct cursor_pos pos;
40 _store_curs_pos( win, &pos );
41 while ( ( win->curs_y - pos.y ) == 0 ) {
42 _wputc( win, ' ', WRAP );
44 _restore_curs_pos( win, &pos );
50 * Delete character under the cursor in a window
52 * @v *win subject window
53 * @ret rc return status code
55 int wdelch ( WINDOW *win ) {
56 _wputc( win, ' ', NOWRAP );
63 * Delete line under a window's cursor
65 * @v *win subject window
66 * @ret rc return status code
68 int wdeleteln ( WINDOW *win ) {
69 struct cursor_pos pos;
71 _store_curs_pos( win, &pos );
72 /* let's just set the cursor to the beginning of the line and
73 let wclrtoeol do the work :) */
74 wmove( win, win->curs_y, 0 );
76 _restore_curs_pos( win, &pos );
81 * Completely clear a window
83 * @v *win subject window
84 * @ret rc return status code
86 int werase ( WINDOW *win ) {
93 * Completely clear the screen
95 * @ret rc return status code
98 stdscr->scr->erase( stdscr->scr, stdscr->attrs );