Adding debian version 3.70~pre8+dfsg-1.
[syslinux-debian/hramrach.git] / gpxe / src / hci / mucurses / clear.c
blob1813939b1eccc33305c90ce1d0055c20ad32ba34
1 #include <curses.h>
2 #include "mucurses.h"
3 #include "cursor.h"
5 /** @file
7 * MuCurses clearing functions
9 */
11 /**
12 * Clear a window to the bottom from current cursor position
14 * @v *win subject window
15 * @ret rc return status code
17 int wclrtobot ( WINDOW *win ) {
18 struct cursor_pos pos;
20 _store_curs_pos( win, &pos );
21 do {
22 _wputc( win, ' ', WRAP );
23 } while ( win->curs_y + win->curs_x );
24 _restore_curs_pos( win, &pos );
26 return OK;
29 /**
30 * Clear a window to the end of the current line
32 * @v *win subject window
33 * @ret rc return status code
35 int wclrtoeol ( WINDOW *win ) {
36 struct cursor_pos pos;
38 _store_curs_pos( win, &pos );
39 while ( ( win->curs_y - pos.y ) == 0 ) {
40 _wputc( win, ' ', WRAP );
42 _restore_curs_pos( win, &pos );
44 return OK;
47 /**
48 * Delete character under the cursor in a window
50 * @v *win subject window
51 * @ret rc return status code
53 int wdelch ( WINDOW *win ) {
54 _wputc( win, ' ', NOWRAP );
55 _wcursback( win );
57 return OK;
60 /**
61 * Delete line under a window's cursor
63 * @v *win subject window
64 * @ret rc return status code
66 int wdeleteln ( WINDOW *win ) {
67 struct cursor_pos pos;
69 _store_curs_pos( win, &pos );
70 /* let's just set the cursor to the beginning of the line and
71 let wclrtoeol do the work :) */
72 wmove( win, win->curs_y, 0 );
73 wclrtoeol( win );
74 _restore_curs_pos( win, &pos );
75 return OK;
78 /**
79 * Completely clear a window
81 * @v *win subject window
82 * @ret rc return status code
84 int werase ( WINDOW *win ) {
85 wmove( win, 0, 0 );
86 wclrtobot( win );
87 return OK;