From 04db44067dd4d9bf7f85ae4d704e740d7420f957 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 20 May 2024 01:33:33 +0900 Subject: Implement multi-line display of multi-line items --- src/result.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/result.go') 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}) } } } -- cgit v1.2.3