mirror of
https://github.com/junegunn/fzf.git
synced 2026-02-10 11:41:43 +08:00
Apply alt-bg on items with even indexes
This commit is contained in:
@@ -2795,12 +2795,14 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
|
|||||||
altBg := t.theme.AltBg
|
altBg := t.theme.AltBg
|
||||||
selectedBg := selected && t.theme.SelectedBg != t.theme.ListBg
|
selectedBg := selected && t.theme.SelectedBg != t.theme.ListBg
|
||||||
if t.jumping != jumpDisabled {
|
if t.jumping != jumpDisabled {
|
||||||
if !altBg.IsColorDefined() {
|
|
||||||
altBg = t.theme.DarkBg
|
|
||||||
}
|
|
||||||
if index < len(t.jumpLabels) {
|
if index < len(t.jumpLabels) {
|
||||||
// Striped
|
// 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))
|
label = t.jumpLabels[index:index+1] + strings.Repeat(" ", util.Max(0, t.pointerLen-1))
|
||||||
if t.pointerLen == 0 {
|
if t.pointerLen == 0 {
|
||||||
extraWidth = 1
|
extraWidth = 1
|
||||||
@@ -2810,7 +2812,7 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
|
|||||||
if current {
|
if current {
|
||||||
label = t.pointer
|
label = t.pointer
|
||||||
}
|
}
|
||||||
alt = !selectedBg && altBg.IsColorDefined() && index%2 == 0
|
alt = !selectedBg && altBg.IsColorDefined() && index%2 == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid unnecessary redraw
|
// Avoid unnecessary redraw
|
||||||
|
|||||||
Reference in New Issue
Block a user