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,6 +147,8 @@ func (result *Result) colorOffsets(matchOffsets []Offset, theme *tui.ColorTheme,
} else {
ansi := itemColors[curr-1]
fg := ansi.color.fg
bg := ansi.color.bg
if theme != nil {
if fg == -1 {
if current {
fg = theme.Current
@ -154,7 +156,6 @@ func (result *Result) colorOffsets(matchOffsets []Offset, theme *tui.ColorTheme,
fg = theme.Fg
}
}
bg := ansi.color.bg
if bg == -1 {
if current {
bg = theme.DarkBg
@ -162,6 +163,7 @@ func (result *Result) colorOffsets(matchOffsets []Offset, theme *tui.ColorTheme,
bg = theme.Bg
}
}
}
colors = append(colors, colorOffset{
offset: [2]int32{int32(start), int32(idx)},
color: tui.PairFor(fg, bg),