Skip to content

Commit

Permalink
feat: join segments when omitting diamonds
Browse files Browse the repository at this point in the history
relates to #697
  • Loading branch information
JanDeDobbeleer committed May 4, 2021
1 parent 248afec commit 3c51292
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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
}
Expand Down

0 comments on commit 3c51292

Please sign in to comment.