From 3a1cbb904c2880256820599a0e32bae0e331621b Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sat, 30 Oct 2021 11:39:08 +0200 Subject: [PATCH] fix: clear parent colors after block rendering relates to #1137 --- src/ansi_color.go | 5 +++++ src/block.go | 1 + 2 files changed, 6 insertions(+) diff --git a/src/ansi_color.go b/src/ansi_color.go index c586fdf4..db17134d 100644 --- a/src/ansi_color.go +++ b/src/ansi_color.go @@ -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`. diff --git a/src/block.go b/src/block.go index f6159572..20f4d1b5 100644 --- a/src/block.go +++ b/src/block.go @@ -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() }