fix: set active colors in debug

This commit is contained in:
Jan De Dobbeleer 2021-11-10 20:03:42 +01:00 committed by Jan De Dobbeleer
parent 2d3b6e4e23
commit d3ab141cd5

View file

@ -58,6 +58,12 @@ func (b *Block) initPlain(env environmentInfo, config *Config) {
b.env = env b.env = env
} }
func (b *Block) setActiveSegment(segment *Segment) {
b.activeSegment = segment
b.activeBackground = segment.background()
b.activeForeground = segment.foreground()
}
func (b *Block) enabled() bool { func (b *Block) enabled() bool {
if b.Type == LineBreak { if b.Type == LineBreak {
return true return true
@ -88,9 +94,7 @@ func (b *Block) renderSegments() string {
if !segment.active { if !segment.active {
continue continue
} }
b.activeSegment = segment b.setActiveSegment(segment)
b.activeBackground = b.activeSegment.background()
b.activeForeground = b.activeSegment.foreground()
b.writer.setColors(b.activeBackground, b.activeForeground) b.writer.setColors(b.activeBackground, b.activeForeground)
b.endPowerline() b.endPowerline()
b.renderSegmentText(segment.stringValue) b.renderSegmentText(segment.stringValue)
@ -202,7 +206,7 @@ func (b *Block) debug() (int, []*SegmentTiming) {
segmentTiming.stringValue = segment.string() segmentTiming.stringValue = segment.string()
segmentTiming.stringDuration = time.Since(start) segmentTiming.stringDuration = time.Since(start)
b.previousActiveSegment = nil b.previousActiveSegment = nil
b.activeSegment = segment b.setActiveSegment(segment)
b.renderSegmentText(segmentTiming.stringValue) b.renderSegmentText(segmentTiming.stringValue)
if b.activeSegment.Style == Powerline { if b.activeSegment.Style == Powerline {
b.writePowerLineSeparator(Transparent, b.activeBackground, true) b.writePowerLineSeparator(Transparent, b.activeBackground, true)