fix: write post- and prefix separate

resolves #843
This commit is contained in:
Jan De Dobbeleer 2021-07-10 11:39:43 +02:00 committed by Jan De Dobbeleer
parent e3723365cb
commit 46b8cea72a

View file

@ -1,7 +1,6 @@
package main
import (
"fmt"
"sync"
"time"
)
@ -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) {