source: bootcd/isolinux/syslinux-6.03/gpxe/src/hci/mucurses/clear.c @ 26ffad7

Last change on this file since 26ffad7 was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 1.6 KB
Line 
1#include <curses.h>
2#include "mucurses.h"
3#include "cursor.h"
4
5/** @file
6 *
7 * MuCurses clearing functions
8 *
9 */
10
11FILE_LICENCE ( GPL2_OR_LATER );
12
13/**
14 * Clear a window to the bottom from current cursor position
15 *
16 * @v *win      subject window
17 * @ret rc      return status code
18 */
19int wclrtobot ( WINDOW *win ) {
20        struct cursor_pos pos;
21
22        _store_curs_pos( win, &pos );
23        do {
24                _wputc( win, ' ', WRAP );
25        } while ( win->curs_y + win->curs_x );
26        _restore_curs_pos( win, &pos );
27
28        return OK;
29}
30
31/**
32 * Clear a window to the end of the current line
33 *
34 * @v *win      subject window
35 * @ret rc      return status code
36 */
37int wclrtoeol ( WINDOW *win ) {
38        struct cursor_pos pos;
39
40        _store_curs_pos( win, &pos );
41        while ( ( win->curs_y - pos.y ) == 0 ) {
42                _wputc( win, ' ', WRAP );
43        }
44        _restore_curs_pos( win, &pos );
45
46        return OK;
47}
48
49/**
50 * Delete character under the cursor in a window
51 *
52 * @v *win      subject window
53 * @ret rc      return status code
54 */
55int wdelch ( WINDOW *win ) {
56        _wputc( win, ' ', NOWRAP );
57        _wcursback( win );
58
59        return OK;
60}
61
62/**
63 * Delete line under a window's cursor
64 *
65 * @v *win      subject window
66 * @ret rc      return status code
67 */
68int wdeleteln ( WINDOW *win ) {
69        struct cursor_pos pos;
70
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 );
75        wclrtoeol( win );
76        _restore_curs_pos( win, &pos );
77        return OK;
78}
79
80/**
81 * Completely clear a window
82 *
83 * @v *win      subject window
84 * @ret rc      return status code
85 */
86int werase ( WINDOW *win ) {
87        wmove( win, 0, 0 );
88        wclrtobot( win );
89        return OK;
90}
Note: See TracBrowser for help on using the repository browser.