feat: join segments when omitting diamonds

relates to #697
This commit is contained in:
Jan De Dobbeleer 2021-05-04 07:40:27 +02:00 committed by Jan De Dobbeleer
parent 248afec9fa
commit 3c5129275e

View file

@ -89,9 +89,10 @@ func (b *Block) renderSegments() string {
}
func (b *Block) endPowerline() {
if b.activeSegment != nil &&
b.activeSegment.Style != Powerline &&
b.previousActiveSegment != nil &&
if b.previousActiveSegment == nil || b.activeSegment == nil {
return
}
if b.activeSegment.Style != Powerline &&
b.previousActiveSegment.Style == Powerline {
b.writePowerLineSeparator(b.getPowerlineColor(false), b.previousActiveSegment.background(), true)
}
@ -113,6 +114,12 @@ func (b *Block) getPowerlineColor(foreground bool) string {
if b.previousActiveSegment == nil {
return Transparent
}
if b.previousActiveSegment.Style == Diamond && len(b.previousActiveSegment.TrailingDiamond) == 0 {
return b.previousActiveSegment.background()
}
if b.activeSegment.Style == Diamond && len(b.activeSegment.LeadingDiamond) == 0 {
return b.activeSegment.background()
}
if !foreground && b.activeSegment.Style != Powerline {
return Transparent
}