diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2024-08-14 23:04:05 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-08-14 23:04:05 +0900 |
| commit | 387c6ef664688582ca1be950e2fe260699aa8862 (patch) | |
| tree | 4478ab1bed3676c1f7ba7059c07f1a1b04b3de22 /src/result.go | |
| parent | 581734c369befcc6544b927042e116e0343a366a (diff) | |
| download | fzf-387c6ef664688582ca1be950e2fe260699aa8862.tar.gz | |
Support hyperlinks (OSC 8) in the main window
Close #2557
Diffstat (limited to 'src/result.go')
| -rw-r--r-- | src/result.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/result.go b/src/result.go index e1c20801..f10db19b 100644 --- a/src/result.go +++ b/src/result.go @@ -16,6 +16,7 @@ type colorOffset struct { offset [2]int32 color tui.ColorPair match bool + url *url } type Result struct { @@ -177,8 +178,11 @@ func (result *Result) colorOffsets(matchOffsets []Offset, theme *tui.ColorTheme, if curr != 0 && idx > start { if curr < 0 { color := colMatch + var url *url if curr < -1 && theme.Colored { - origColor := ansiToColorPair(itemColors[-curr-2], colMatch) + ansi := itemColors[-curr-2] + url = ansi.color.url + origColor := ansiToColorPair(ansi, colMatch) // hl or hl+ only sets the foreground color, so colMatch is the // combination of either [hl and bg] or [hl+ and bg+]. // @@ -194,13 +198,14 @@ func (result *Result) colorOffsets(matchOffsets []Offset, theme *tui.ColorTheme, } } colors = append(colors, colorOffset{ - offset: [2]int32{int32(start), int32(idx)}, color: color, match: true}) + offset: [2]int32{int32(start), int32(idx)}, color: color, match: true, url: url}) } else { ansi := itemColors[curr-1] colors = append(colors, colorOffset{ offset: [2]int32{int32(start), int32(idx)}, color: ansiToColorPair(ansi, colBase), - match: false}) + match: false, + url: ansi.color.url}) } } } |
