fix(segment): only join diamonds with no diamond at end

This commit is contained in:
Jan De Dobbeleer 2024-02-29 17:55:28 +01:00 committed by Jan De Dobbeleer
parent a5fc8dbed5
commit bb2ac0cec5
2 changed files with 7 additions and 4 deletions

View file

@ -151,7 +151,7 @@ func (b *Block) renderActiveSegment() {
b.writer.Write(ansi.Background, ansi.Foreground, b.activeSegment.text)
case Diamond:
background := ansi.Transparent
if b.previousActiveSegment != nil && !b.previousActiveSegment.hasTrailingDiamond() {
if b.previousActiveSegment != nil && b.previousActiveSegment.hasEmptyDiamondAtEnd() {
background = b.previousActiveSegment.background()
}
b.writer.Write(background, ansi.Background, b.activeSegment.LeadingDiamond)

View file

@ -376,9 +376,12 @@ func (segment *Segment) isPowerline() bool {
return style == Powerline || style == Accordion
}
func (segment *Segment) hasTrailingDiamond() bool {
style := segment.style()
return style == Diamond && len(segment.TrailingDiamond) > 0
func (segment *Segment) hasEmptyDiamondAtEnd() bool {
if segment.style() != Diamond {
return false
}
return len(segment.TrailingDiamond) == 0
}
func (segment *Segment) cwdIncluded() bool {