- separated curses.c out into separate source files to optimise

library use later on
- some small mods to existing functions
This commit is contained in:
Dan Lynch
2006-06-08 17:23:37 +00:00
parent 1697c78848
commit ad1aca0634
12 changed files with 754 additions and 0 deletions

51
src/hci/mucurses/clear.c Normal file
View File

@@ -0,0 +1,51 @@
#include <curses.h>
#include "core.h"
#include "cursor.h"
/**
* Clear a window to the bottom from current cursor position
*
* @v *win subject window
* @ret rc return status code
*/
int wclrtobot ( WINDOW *win ) {
struct cursor_pos pos;
_store_curs_pos( win, &pos );
do {
_wputch( win, (unsigned)' ', WRAP );
} while ( win->curs_y + win->curs_x );
_restore_curs_pos( win, &pos );
return OK;
}
/**
* Clear a window to the end of the current line
*
* @v *win subject window
* @ret rc return status code
*/
int wclrtoeol ( WINDOW *win ) {
struct cursor_pos pos;
_store_curs_pos( win, &pos );
while ( ( win->curs_y - pos.y ) == 0 ) {
_wputch( win, (unsigned)' ', WRAP );
}
_restore_curs_pos( win, &pos );
return OK;
}
/**
* Completely clear a window
*
* @v *win subject window
* @ret rc return status code
*/
int werase ( WINDOW *win ) {
wmove( win, 0, 0 );
wclrtobot( win );
return OK;
}