Skip to content

Commit

Permalink
fix: set active colors in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Nov 10, 2021
1 parent 2d3b6e4 commit d3ab141
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ func (b *Block) initPlain(env environmentInfo, config *Config) {
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 {
if b.Type == LineBreak {
return true
Expand Down Expand Up @@ -88,9 +94,7 @@ func (b *Block) renderSegments() string {
if !segment.active {
continue
}
b.activeSegment = segment
b.activeBackground = b.activeSegment.background()
b.activeForeground = b.activeSegment.foreground()
b.setActiveSegment(segment)
b.writer.setColors(b.activeBackground, b.activeForeground)
b.endPowerline()
b.renderSegmentText(segment.stringValue)
Expand Down Expand Up @@ -202,7 +206,7 @@ func (b *Block) debug() (int, []*SegmentTiming) {
segmentTiming.stringValue = segment.string()
segmentTiming.stringDuration = time.Since(start)
b.previousActiveSegment = nil
b.activeSegment = segment
b.setActiveSegment(segment)
b.renderSegmentText(segmentTiming.stringValue)
if b.activeSegment.Style == Powerline {
b.writePowerLineSeparator(Transparent, b.activeBackground, true)
Expand Down

0 comments on commit d3ab141

Please sign in to comment.