From c1bac56f8546f2cadbaefbda33ca23efeb269bf9 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 19 Dec 2006 01:17:10 +0000 Subject: [PATCH] Use current attributes when erasing. --- src/hci/mucurses/clear.c | 6 +++--- src/hci/mucurses/mucurses.c | 13 ++++++++++++- src/hci/mucurses/mucurses.h | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/hci/mucurses/clear.c b/src/hci/mucurses/clear.c index b4382c59..1813939b 100644 --- a/src/hci/mucurses/clear.c +++ b/src/hci/mucurses/clear.c @@ -19,7 +19,7 @@ int wclrtobot ( WINDOW *win ) { _store_curs_pos( win, &pos ); do { - _wputch( win, (unsigned)' ', WRAP ); + _wputc( win, ' ', WRAP ); } while ( win->curs_y + win->curs_x ); _restore_curs_pos( win, &pos ); @@ -37,7 +37,7 @@ int wclrtoeol ( WINDOW *win ) { _store_curs_pos( win, &pos ); while ( ( win->curs_y - pos.y ) == 0 ) { - _wputch( win, (unsigned)' ', WRAP ); + _wputc( win, ' ', WRAP ); } _restore_curs_pos( win, &pos ); @@ -51,7 +51,7 @@ int wclrtoeol ( WINDOW *win ) { * @ret rc return status code */ int wdelch ( WINDOW *win ) { - _wputch( win, (unsigned)' ', NOWRAP ); + _wputc( win, ' ', NOWRAP ); _wcursback( win ); return OK; diff --git a/src/hci/mucurses/mucurses.c b/src/hci/mucurses/mucurses.c index 083f6b37..775422e6 100644 --- a/src/hci/mucurses/mucurses.c +++ b/src/hci/mucurses/mucurses.c @@ -58,6 +58,17 @@ void _wputch ( WINDOW *win, chtype ch, int wrap ) { } } +/** + * Write a single character to a window + * + * @v *win window in which to write + * @v c character rendition to write + * @v wrap wrap "switch" + */ +void _wputc ( WINDOW *win, char c, int wrap ) { + _wputch ( win, ( c | win->attrs ), wrap ); +} + /** * Retreat the cursor back one position (useful for a whole host of * ops) @@ -100,7 +111,7 @@ void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n ) { */ void _wputstr ( WINDOW *win, const char *str, int wrap, int n ) { for ( ; *str && n-- ; str++ ) { - _wputch( win, *str | win->attrs, wrap ); + _wputc ( win, *str, wrap ); } } diff --git a/src/hci/mucurses/mucurses.h b/src/hci/mucurses/mucurses.h index c18e2ff3..aca9b5c5 100644 --- a/src/hci/mucurses/mucurses.h +++ b/src/hci/mucurses/mucurses.h @@ -13,6 +13,7 @@ extern SCREEN _ansi_screen; extern void _wputch ( WINDOW *win, chtype ch, int wrap ); +extern void _wputc ( WINDOW *win, char c, int wrap ); extern void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n ); extern void _wputstr ( WINDOW *win, const char *str, int wrap, int n ); extern void _wcursback ( WINDOW *win );