瀏覽代碼

Use current attributes when erasing.

tags/v0.9.3
Michael Brown 18 年之前
父節點
當前提交
c1bac56f85
共有 3 個檔案被更改,包括 16 行新增4 行删除
  1. 3
    3
      src/hci/mucurses/clear.c
  2. 12
    1
      src/hci/mucurses/mucurses.c
  3. 1
    0
      src/hci/mucurses/mucurses.h

+ 3
- 3
src/hci/mucurses/clear.c 查看文件

@@ -19,7 +19,7 @@ int wclrtobot ( WINDOW *win ) {
19 19
 
20 20
 	_store_curs_pos( win, &pos );
21 21
 	do {
22
-		_wputch( win, (unsigned)' ', WRAP );
22
+		_wputc( win, ' ', WRAP );
23 23
 	} while ( win->curs_y + win->curs_x );
24 24
 	_restore_curs_pos( win, &pos );
25 25
 
@@ -37,7 +37,7 @@ int wclrtoeol ( WINDOW *win ) {
37 37
 
38 38
 	_store_curs_pos( win, &pos );
39 39
 	while ( ( win->curs_y - pos.y ) == 0 ) {
40
-		_wputch( win, (unsigned)' ', WRAP );
40
+		_wputc( win, ' ', WRAP );
41 41
 	}
42 42
 	_restore_curs_pos( win, &pos );
43 43
 
@@ -51,7 +51,7 @@ int wclrtoeol ( WINDOW *win ) {
51 51
  * @ret rc	return status code
52 52
  */
53 53
 int wdelch ( WINDOW *win ) {
54
-	_wputch( win, (unsigned)' ', NOWRAP );
54
+	_wputc( win, ' ', NOWRAP );
55 55
 	_wcursback( win );
56 56
 
57 57
 	return OK;

+ 12
- 1
src/hci/mucurses/mucurses.c 查看文件

@@ -58,6 +58,17 @@ void _wputch ( WINDOW *win, chtype ch, int wrap ) {
58 58
 	}
59 59
 }
60 60
 
61
+/**
62
+ * Write a single character to a window
63
+ *
64
+ * @v *win	window in which to write
65
+ * @v c		character rendition to write
66
+ * @v wrap	wrap "switch"
67
+ */
68
+void _wputc ( WINDOW *win, char c, int wrap ) {
69
+	_wputch ( win, ( c | win->attrs ), wrap );
70
+}
71
+
61 72
 /**
62 73
  * Retreat the cursor back one position (useful for a whole host of
63 74
  * ops)
@@ -100,7 +111,7 @@ void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n ) {
100 111
  */
101 112
 void _wputstr ( WINDOW *win, const char *str, int wrap, int n ) {
102 113
 	for ( ; *str && n-- ; str++ ) {
103
-		_wputch( win, *str | win->attrs, wrap );
114
+		_wputc ( win, *str, wrap );
104 115
 	}
105 116
 }
106 117
 

+ 1
- 0
src/hci/mucurses/mucurses.h 查看文件

@@ -13,6 +13,7 @@
13 13
 extern SCREEN _ansi_screen;
14 14
 
15 15
 extern void _wputch ( WINDOW *win, chtype ch, int wrap );
16
+extern void _wputc ( WINDOW *win, char c, int wrap );
16 17
 extern void _wputchstr ( WINDOW *win, const chtype *chstr, int wrap, int n );
17 18
 extern void _wputstr ( WINDOW *win, const char *str, int wrap, int n );
18 19
 extern void _wcursback ( WINDOW *win );

Loading…
取消
儲存