fix: clear parent colors after block rendering

relates to #1137
This commit is contained in:
Jan De Dobbeleer 2021-10-30 11:39:08 +02:00 committed by Jan De Dobbeleer
parent 1b29ae136d
commit 3a1cbb904c
2 changed files with 6 additions and 0 deletions

View file

@ -49,6 +49,7 @@ type colorWriter interface {
reset()
setColors(background, foreground string)
setParentColors(background, foreground string)
clearParentColors()
}
// AnsiColor writes colorized strings
@ -90,6 +91,10 @@ func (a *AnsiColor) setParentColors(background, foreground string) {
}
}
func (a *AnsiColor) clearParentColors() {
a.ParentColors = nil
}
// Gets the ANSI color code for a given color string.
// This can include a valid hex color in the format `#FFFFFF`,
// but also a name of one of the first 16 ANSI colors like `lightBlue`.

View file

@ -98,6 +98,7 @@ func (b *Block) renderSegments() string {
if b.previousActiveSegment != nil && b.previousActiveSegment.Style == Powerline {
b.writePowerLineSeparator(Transparent, b.previousActiveSegment.background(), true)
}
b.writer.clearParentColors()
return b.writer.string()
}