From 7cfa6f0265a7a786b931dde03b75843124a984b2 Mon Sep 17 00:00:00 2001
From: Junegunn Choi <junegunn.c@gmail.com>
Date: Fri, 8 Sep 2017 18:33:17 +0900
Subject: [PATCH] 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
---
 src/tui/light.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/tui/light.go b/src/tui/light.go
index 15f4e012..fe9035ea 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -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
 	}
-- 
GitLab