Introduce matched style

This commit is contained in:
Takashi Kokubun 2014-07-04 01:33:45 +09:00
parent 675bb8b7c0
commit 772d804c25
3 changed files with 6 additions and 3 deletions

View file

@ -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},
}
}

View file

@ -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"]
}
}
`

View file

@ -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)
}