File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,13 @@ internal class Curses {
162
162
func attributeSet( windowHandle: UnsafeMutablePointer < WINDOW > , attributeValue: Int ) {
163
163
CNCURSES . wattrset ( windowHandle, Int32 ( attributeValue) )
164
164
}
165
+
166
+ func backgroundSet( windowHandle: UnsafeMutablePointer < WINDOW > , attributeValue: Int , character: Character ) {
167
+ let unicodeScalars = character. unicodeScalars
168
+ let ascii = UInt ( unicodeScalars [ unicodeScalars. startIndex] . value)
169
+ let attributeAndCharacter : UInt = UInt ( attributeValue) + ascii
170
+ CNCURSES . wbkgd ( windowHandle, attributeAndCharacter)
171
+ }
165
172
166
173
var maxColorCount : Int {
167
174
return Int ( COLORS)
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ public class Window {
49
49
curses. refresh ( windowHandle: windowHandle)
50
50
}
51
51
52
+ public func backgroundSet( attribute: Attribute , character: Character = " " ) {
53
+ let attributeValue = attribute. value
54
+ curses. backgroundSet ( windowHandle: windowHandle, attributeValue: attributeValue, character: character)
55
+ }
56
+
52
57
public func clear( ) {
53
58
curses. clear ( windowHandle: windowHandle)
54
59
}
You can’t perform that action at this time.
0 commit comments