fix(diamond): join segments when no trailing diamond

This commit is contained in:
Jan De Dobbeleer 2024-02-26 15:13:34 +01:00 committed by Jan De Dobbeleer
parent 060b712bbe
commit a5fc8dbed5
2 changed files with 10 additions and 1 deletions

View file

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

View file

@ -376,6 +376,11 @@ 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) cwdIncluded() bool {
value, ok := segment.Properties[properties.IncludeFolders]
if !ok {