Skip to content

Commit 35109a6

Browse files
committed
Enabling field background colors
1 parent edc9288 commit 35109a6

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Sources/Window.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ public class Window {
150150
// Save cursor position to be restored later and move cursor to field
151151
cursor.pushPosition()
152152
cursor.position = fieldPosition
153+
154+
// If a fieldColorPair is specified, we turn that color on
155+
if let fieldColorPair = fieldColorPair {
156+
turnOn(fieldColorPair)
157+
let pad = String(repeating:" ", count:maxCharacters)
158+
write(pad)
159+
cursor.position = fieldPosition
160+
}
153161

154162
var string = ""
155163
var insertionPoint = string.startIndex
@@ -225,6 +233,11 @@ public class Window {
225233
} while !shouldExit
226234

227235

236+
// If a fieldColorPair is specified, we turn that color off
237+
if let fieldColorPair = fieldColorPair {
238+
turnOff(fieldColorPair)
239+
}
240+
228241
// Restore cursor position and return string
229242
cursor.popPosition()
230243
return string

0 commit comments

Comments
 (0)