summaryrefslogtreecommitdiff
path: root/src/result.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-05-20 01:33:33 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-05-20 09:25:30 +0900
commit04db44067dd4d9bf7f85ae4d704e740d7420f957 (patch)
treeccb739f25b4e79d8d03ec076042ad65cd62efe4e /src/result.go
parent5b204c54f9d16accdf66bb24477e9eff4fc3a21a (diff)
downloadfzf-04db44067dd4d9bf7f85ae4d704e740d7420f957.tar.gz
Implement multi-line display of multi-line items
Diffstat (limited to 'src/result.go')
-rw-r--r--src/result.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/result.go b/src/result.go
index b0428294..b9e737de 100644
--- a/src/result.go
+++ b/src/result.go
@@ -15,6 +15,7 @@ type Offset [2]int32
type colorOffset struct {
offset [2]int32
color tui.ColorPair
+ match bool
}
type Result struct {
@@ -109,7 +110,7 @@ func (result *Result) colorOffsets(matchOffsets []Offset, theme *tui.ColorTheme,
if len(itemColors) == 0 {
var offsets []colorOffset
for _, off := range matchOffsets {
- offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch})
+ offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch, match: true})
}
return offsets
}
@@ -193,12 +194,13 @@ func (result *Result) colorOffsets(matchOffsets []Offset, theme *tui.ColorTheme,
}
}
colors = append(colors, colorOffset{
- offset: [2]int32{int32(start), int32(idx)}, color: color})
+ offset: [2]int32{int32(start), int32(idx)}, color: color, match: true})
} else {
ansi := itemColors[curr-1]
colors = append(colors, colorOffset{
offset: [2]int32{int32(start), int32(idx)},
- color: ansiToColorPair(ansi, colBase)})
+ color: ansiToColorPair(ansi, colBase),
+ match: false})
}
}
}