From 1fc565984244bdaf21e736bb9a129fff0de7cab1 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 29 Sep 2016 00:54:27 +0900 Subject: Add support for more ANSI color attributes (#674) Dim, underline, blink, reverse --- src/result.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/result.go') diff --git a/src/result.go b/src/result.go index 87478aba..9152f671 100644 --- a/src/result.go +++ b/src/result.go @@ -14,7 +14,7 @@ type Offset [2]int32 type colorOffset struct { offset [2]int32 color int - bold bool + attr curses.Attr index int32 } @@ -91,14 +91,14 @@ func minRank() rank { return rank{index: 0, points: [4]uint16{math.MaxUint16, 0, 0, 0}} } -func (result *Result) colorOffsets(matchOffsets []Offset, color int, bold bool, current bool) []colorOffset { +func (result *Result) colorOffsets(matchOffsets []Offset, color int, attr curses.Attr, current bool) []colorOffset { itemColors := result.item.Colors() if len(itemColors) == 0 { var offsets []colorOffset for _, off := range matchOffsets { - offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: color, bold: bold}) + offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: color, attr: attr}) } return offsets } @@ -142,7 +142,7 @@ func (result *Result) colorOffsets(matchOffsets []Offset, color int, bold bool, if curr != 0 && idx > start { if curr == -1 { colors = append(colors, colorOffset{ - offset: [2]int32{int32(start), int32(idx)}, color: color, bold: bold}) + offset: [2]int32{int32(start), int32(idx)}, color: color, attr: attr}) } else { ansi := itemColors[curr-1] fg := ansi.color.fg @@ -164,7 +164,7 @@ func (result *Result) colorOffsets(matchOffsets []Offset, color int, bold bool, colors = append(colors, colorOffset{ offset: [2]int32{int32(start), int32(idx)}, color: curses.PairFor(fg, bg), - bold: ansi.color.bold || bold}) + attr: ansi.color.attr | attr}) } } } -- cgit v1.2.3