From 772d804c2544cc82df3a59bbd0cb00a77db3d860 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Fri, 4 Jul 2014 01:33:45 +0900 Subject: [PATCH] Introduce matched style --- config.go | 4 +++- config_test.go | 3 ++- view.go | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index 2383bd6..6443e7a 100644 --- a/config.go +++ b/config.go @@ -77,6 +77,7 @@ type StyleSet struct { SavedSelection Style `json:"SavedSelection"` Selected Style `json:"Selected"` Query Style `json:"Query"` + Matched Style `json:"Matched"` } func NewStyleSet() StyleSet { @@ -84,7 +85,8 @@ func NewStyleSet() StyleSet { Basic: Style{fg: termbox.ColorDefault, bg: termbox.ColorDefault}, SavedSelection: Style{fg: termbox.ColorBlack | termbox.AttrBold, bg: termbox.ColorCyan}, Selected: Style{fg: termbox.ColorDefault | termbox.AttrUnderline, bg: termbox.ColorMagenta}, - Query: Style{fg: termbox.ColorCyan, bg: termbox.ColorDefault}, + Query: Style{fg: termbox.ColorDefault, bg: termbox.ColorDefault}, + Matched: Style{fg: termbox.ColorCyan, bg: termbox.ColorDefault}, } } diff --git a/config_test.go b/config_test.go index 1710927..2f686bf 100644 --- a/config_test.go +++ b/config_test.go @@ -21,7 +21,8 @@ func TestReadRC(t *testing.T) { "Style": { "Basic": ["on_default", "default"], "Selected": ["underline", "on_cyan", "black"], - "Query": ["yellow", "bold"] + "Query": ["yellow", "bold"], + "Matched": ["cyan", "bold", "on_red"] } } ` diff --git a/view.go b/view.go index 89ef250..c80a427 100644 --- a/view.go +++ b/view.go @@ -233,7 +233,7 @@ CALCULATE_PAGE: index += len(c) } c := line[m[0]:m[1]] - printTB(prev, n, v.config.Style.Query.fg, bgAttr|v.config.Style.Query.bg, c) + printTB(prev, n, v.config.Style.Matched.fg, bgAttr|v.config.Style.Matched.bg, c) prev += runewidth.StringWidth(c) index += len(c) }