summaryrefslogtreecommitdiff
path: root/src/result.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-20 00:49:08 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-01-20 01:02:58 +0900
commita4db8bd7b550c010b99f26337d841395e319890a (patch)
tree89f4ca038fa6c5a8d599133413852e9581e5ea02 /src/result.go
parentf1c1b02d77a9d36cc5195a11ec2e162d829ddb9d (diff)
downloadfzf-a4db8bd7b550c010b99f26337d841395e319890a.tar.gz
Make 'current-fg' inherit from 'fg' to simplify configuration
If you do not want 'current-fg' to inherit attributes of 'fg', prefix it with 'regular:' to reset them. # italic and underline fzf --color fg:italic,current-fg:underline # only underline fzf --color fg:italic,current-fg:regular:underline
Diffstat (limited to 'src/result.go')
-rw-r--r--src/result.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/result.go b/src/result.go
index ada31d59..10e0c6d6 100644
--- a/src/result.go
+++ b/src/result.go
@@ -150,10 +150,6 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
}
for _, off := range nthOffsets {
- // Exclude the whole line
- if int(off[1])-int(off[0]) == result.item.text.Length() {
- continue
- }
for i := off[0]; i < off[1]; i++ {
cols[i].nth = true
}
@@ -190,7 +186,12 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
add := func(idx int) {
if (curr.color || curr.nth || curr.match) && idx > start {
if curr.match {
- color := colMatch
+ var color tui.ColorPair
+ if curr.nth {
+ color = colBase.WithAttr(attrNth).Merge(colMatch)
+ } else {
+ color = colBase.Merge(colMatch)
+ }
var url *url
if curr.color && theme.Colored {
ansi := itemColors[curr.index]
@@ -206,13 +207,13 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
// echo -e "\x1b[42mfoo\x1b[mbar" | fzf --ansi --color bg+:1,hl+:-1:underline
if color.Fg().IsDefault() && origColor.HasBg() {
color = origColor
+ if curr.nth {
+ color = color.WithAttr(attrNth)
+ }
} else {
color = origColor.MergeNonDefault(color)
}
}
- if curr.nth {
- color = color.WithAttr(attrNth)
- }
colors = append(colors, colorOffset{
offset: [2]int32{int32(start), int32(idx)}, color: color, match: true, url: url})
} else if curr.color {