iPXE
Functions
clear.c File Reference

MuCurses clearing functions. More...

#include <curses.h>
#include "mucurses.h"
#include "cursor.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
int wclrtobot (WINDOW *win)
 Clear a window to the bottom from current cursor position. More...
 
int wclrtoeol (WINDOW *win)
 Clear a window to the end of the current line. More...
 
int wdelch (WINDOW *win)
 Delete character under the cursor in a window. More...
 
int wdeleteln (WINDOW *win)
 Delete line under a window's cursor. More...
 
int werase (WINDOW *win)
 Completely clear a window. More...
 
int erase (void)
 Completely clear the screen. More...
 

Detailed Description

MuCurses clearing functions.

Definition in file clear.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ wclrtobot()

int wclrtobot ( WINDOW win)

Clear a window to the bottom from current cursor position.

Parameters
*winsubject window
Return values
rcreturn status code

Definition at line 19 of file clear.c.

19  {
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 }
unsigned int curs_y
Definition: curses.h:97
Definition: sis900.h:208
static void _restore_curs_pos(WINDOW *win, struct cursor_pos *pos)
Restore cursor position from encoded backup variable.
Definition: cursor.h:22
static void _store_curs_pos(WINDOW *win, struct cursor_pos *pos)
Store cursor position for later restoration.
Definition: cursor.h:32
void _wputc(WINDOW *win, char c, int wrap) __nonnull
Write a single character to a window.
Definition: mucurses.c:77
#define WRAP
Definition: mucurses.h:12
unsigned int curs_x
window cursor position
Definition: curses.h:97

References _restore_curs_pos(), _store_curs_pos(), _wputc(), _curses_window::curs_x, _curses_window::curs_y, OK, and WRAP.

Referenced by clrtobot(), and werase().

◆ wclrtoeol()

int wclrtoeol ( WINDOW win)

Clear a window to the end of the current line.

Parameters
*winsubject window
Return values
rcreturn status code

Definition at line 37 of file clear.c.

37  {
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 }
unsigned int curs_y
Definition: curses.h:97
Definition: sis900.h:208
static void _restore_curs_pos(WINDOW *win, struct cursor_pos *pos)
Restore cursor position from encoded backup variable.
Definition: cursor.h:22
static void _store_curs_pos(WINDOW *win, struct cursor_pos *pos)
Store cursor position for later restoration.
Definition: cursor.h:32
void _wputc(WINDOW *win, char c, int wrap) __nonnull
Write a single character to a window.
Definition: mucurses.c:77
#define WRAP
Definition: mucurses.h:12

References _restore_curs_pos(), _store_curs_pos(), _wputc(), _curses_window::curs_y, OK, WRAP, and cursor_pos::y.

Referenced by clrtoeol(), slk_clear(), and wdeleteln().

◆ wdelch()

int wdelch ( WINDOW win)

Delete character under the cursor in a window.

Parameters
*winsubject window
Return values
rcreturn status code

Definition at line 55 of file clear.c.

55  {
56  _wputc( win, ' ', NOWRAP );
57  _wcursback( win );
58 
59  return OK;
60 }
Definition: sis900.h:208
#define NOWRAP
Definition: mucurses.h:13
void _wcursback(WINDOW *win) __nonnull
Retreat the cursor back one position (useful for a whole host of ops)
Definition: mucurses.c:87
void _wputc(WINDOW *win, char c, int wrap) __nonnull
Write a single character to a window.
Definition: mucurses.c:77

References _wcursback(), _wputc(), NOWRAP, and OK.

Referenced by delch(), mvdelch(), mvwdelch(), wgetch(), and wgetnstr().

◆ wdeleteln()

int wdeleteln ( WINDOW win)

Delete line under a window's cursor.

Parameters
*winsubject window
Return values
rcreturn status code

Definition at line 68 of file clear.c.

68  {
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 }
int wmove(WINDOW *win, int y, int x) __nonnull
Move a window's cursor to the specified position.
Definition: mucurses.c:135
unsigned int curs_y
Definition: curses.h:97
Definition: sis900.h:208
int wclrtoeol(WINDOW *win)
Clear a window to the end of the current line.
Definition: clear.c:37
static void _restore_curs_pos(WINDOW *win, struct cursor_pos *pos)
Restore cursor position from encoded backup variable.
Definition: cursor.h:22
static void _store_curs_pos(WINDOW *win, struct cursor_pos *pos)
Store cursor position for later restoration.
Definition: cursor.h:32

References _restore_curs_pos(), _store_curs_pos(), _curses_window::curs_y, OK, wclrtoeol(), and wmove().

Referenced by deleteln().

◆ werase()

int werase ( WINDOW win)

Completely clear a window.

Parameters
*winsubject window
Return values
rcreturn status code

Definition at line 86 of file clear.c.

86  {
87  wmove( win, 0, 0 );
88  wclrtobot( win );
89  return OK;
90 }
int wmove(WINDOW *win, int y, int x) __nonnull
Move a window's cursor to the specified position.
Definition: mucurses.c:135
Definition: sis900.h:208
int wclrtobot(WINDOW *win)
Clear a window to the bottom from current cursor position.
Definition: clear.c:19

References OK, wclrtobot(), and wmove().

◆ erase()

int erase ( void  )

Completely clear the screen.

Return values
rcreturn status code

Definition at line 97 of file clear.c.

97  {
98  stdscr->scr->erase( stdscr->scr, stdscr->attrs );
99  return OK;
100 }
Definition: sis900.h:208
#define stdscr
Definition: curses.h:110

References OK, and stdscr.

Referenced by login_ui(), settings_ui(), and show_menu().