Apply alt-bg on items with even indexes

This commit is contained in:
Junegunn Choi
2025-05-03 23:08:14 +09:00
parent a316f066c2
commit 22aba02875

View File

@@ -2795,12 +2795,14 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
altBg := t.theme.AltBg
selectedBg := selected && t.theme.SelectedBg != t.theme.ListBg
if t.jumping != jumpDisabled {
if !altBg.IsColorDefined() {
altBg = t.theme.DarkBg
}
if index < len(t.jumpLabels) {
// Striped
alt = index%2 == 0
if !altBg.IsColorDefined() {
altBg = t.theme.DarkBg
alt = index%2 == 0
} else {
alt = index%2 == 1
}
label = t.jumpLabels[index:index+1] + strings.Repeat(" ", util.Max(0, t.pointerLen-1))
if t.pointerLen == 0 {
extraWidth = 1
@@ -2810,7 +2812,7 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
if current {
label = t.pointer
}
alt = !selectedBg && altBg.IsColorDefined() && index%2 == 0
alt = !selectedBg && altBg.IsColorDefined() && index%2 == 1
}
// Avoid unnecessary redraw