Fix panic when color is disabled and header lines contain ANSI colors

Close #732
This commit is contained in:
Junegunn Choi 2016-11-09 12:05:45 +09:00
parent a221c672fb
commit 7ce427ff47
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -147,19 +147,21 @@ func (result *Result) colorOffsets(matchOffsets []Offset, theme *tui.ColorTheme,
} else {
ansi := itemColors[curr-1]
fg := ansi.color.fg
if fg == -1 {
if current {
fg = theme.Current
} else {
fg = theme.Fg
}
}
bg := ansi.color.bg
if bg == -1 {
if current {
bg = theme.DarkBg
} else {
bg = theme.Bg
if theme != nil {
if fg == -1 {
if current {
fg = theme.Current
} else {
fg = theme.Fg
}
}
if bg == -1 {
if current {
bg = theme.DarkBg
} else {
bg = theme.Bg
}
}
}
colors = append(colors, colorOffset{