Skip to content

Commit

Permalink
fix: write post- and prefix separate
Browse files Browse the repository at this point in the history
resolves #843
  • Loading branch information
JanDeDobbeleer committed Jul 10, 2021
1 parent e372336 commit 0003976
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/block.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"sync"
"time"
)
Expand Down Expand Up @@ -167,10 +166,12 @@ func (b *Block) renderDiamondSegment(text string) {
}

func (b *Block) renderText(text string) {
bg := b.activeSegment.background()
fg := b.activeSegment.foreground()
defaultValue := " "
prefix := b.activeSegment.getValue(Prefix, defaultValue)
postfix := b.activeSegment.getValue(Postfix, defaultValue)
b.writer.write(b.activeSegment.background(), b.activeSegment.foreground(), fmt.Sprintf("%s%s%s", prefix, text, postfix))
b.writer.write(bg, fg, b.activeSegment.getValue(Prefix, defaultValue))
b.writer.write(bg, fg, text)
b.writer.write(bg, fg, b.activeSegment.getValue(Postfix, defaultValue))
}

func (b *Block) debug() (int, []*SegmentTiming) {
Expand Down

0 comments on commit 0003976

Please sign in to comment.