Fix custom foreground color inside preview window (addendum)

This fixes foreground color inside preview window when the text has ANSI
attributes except for foreground color.

Close #1046
This commit is contained in:
Junegunn Choi 2017-09-08 18:33:17 +09:00
parent e3973c74e7
commit 7cfa6f0265
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -105,6 +105,7 @@ type LightWindow struct {
posx int
posy int
tabstop int
fg Color
bg Color
}
@ -633,8 +634,10 @@ func (r *LightRenderer) NewWindow(top int, left int, width int, height int, bord
width: width,
height: height,
tabstop: r.tabstop,
fg: colDefault,
bg: colDefault}
if r.theme != nil {
w.fg = r.theme.Fg
w.bg = r.theme.Bg
}
w.drawBorder()
@ -881,6 +884,9 @@ func (w *LightWindow) Fill(text string) FillReturn {
func (w *LightWindow) CFill(fg Color, bg Color, attr Attr, text string) FillReturn {
w.Move(w.posy, w.posx)
if fg == colDefault {
fg = w.fg
}
if bg == colDefault {
bg = w.bg
}