mirror of
https://github.com/junegunn/fzf.git
synced 2026-03-05 22:54:31 +08:00
Apply selected-fg attrs on current line when item is selected
When an item is both current and selected, the current-line rendering ignored selected-fg attrs entirely. e.g. echo foo | fzf --color fg:dim,nth:regular,current-fg:underline,selected-fg:italic --bind result:select --multi The italic from selected-fg was lost. Merge NthSelectedAttr into the overlay and rebuild colBase attr with the correct precedence chain: fg < selected-fg < current-fg.
This commit is contained in:
@@ -3507,7 +3507,14 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
|
||||
}
|
||||
return indentSize
|
||||
}
|
||||
finalLineNum = t.printHighlighted(result, tui.ColCurrent, tui.ColCurrentMatch, true, true, !matched, line, maxLine, forceRedraw, preTask, postTask, t.theme.NthCurrentAttr)
|
||||
colCurrent := tui.ColCurrent
|
||||
nthOverlay := t.theme.NthCurrentAttr
|
||||
if selected {
|
||||
nthOverlay = t.theme.NthSelectedAttr.Merge(t.theme.NthCurrentAttr)
|
||||
baseAttr := tui.ColNormal.Attr().Merge(t.theme.NthSelectedAttr).Merge(t.theme.NthCurrentAttr)
|
||||
colCurrent = colCurrent.WithNewAttr(baseAttr)
|
||||
}
|
||||
finalLineNum = t.printHighlighted(result, colCurrent, tui.ColCurrentMatch, true, true, !matched, line, maxLine, forceRedraw, preTask, postTask, nthOverlay)
|
||||
} else {
|
||||
preTask := func(marker markerClass) int {
|
||||
w := t.window.Width() - t.pointerLen
|
||||
|
||||
Reference in New Issue
Block a user