mirror of
https://github.com/junegunn/fzf.git
synced 2026-08-13 19:31:06 +08:00
Keep base fg/bg when resolving colors in bw theme
Trailing prompt space and other base-colored segments no longer reset to terminal default
This commit is contained in:
+4
-1
@@ -198,7 +198,10 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
|
|||||||
start := 0
|
start := 0
|
||||||
ansiToColorPair := func(ansi ansiOffset, base tui.ColorPair) tui.ColorPair {
|
ansiToColorPair := func(ansi ansiOffset, base tui.ColorPair) tui.ColorPair {
|
||||||
if !theme.Colored {
|
if !theme.Colored {
|
||||||
return tui.NewColorPair(-1, -1, ansi.color.attr).MergeAttr(base)
|
// Ignore ANSI colors but keep the attributes. Retain the base
|
||||||
|
// colors (e.g. an overridden input-bg or list-bg) instead of
|
||||||
|
// resetting to the terminal default.
|
||||||
|
return tui.NewColorPair(base.Fg(), base.Bg(), ansi.color.attr).MergeAttr(base)
|
||||||
}
|
}
|
||||||
// fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular
|
// fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular
|
||||||
if base.ShouldStripColors() {
|
if base.ShouldStripColors() {
|
||||||
|
|||||||
Reference in New Issue
Block a user