Add *Gui.Highlight to enable/disable current view's custom color

This commit is contained in:
Roi Martin 2016-10-18 23:30:43 +02:00
parent c0ae071931
commit a7019c8547
3 changed files with 7 additions and 2 deletions

View File

@ -100,6 +100,7 @@ func main() {
}
defer g.Close()
g.Highlight = true
g.SelFgColor = gocui.ColorGreen
g.SetLayout(layout)

View File

@ -28,6 +28,7 @@ func main() {
defer g.Close()
g.SetLayout(layout)
g.Highlight = true
g.SelFgColor = gocui.ColorRed
if err := initKeybindings(g); err != nil {

7
gui.go
View File

@ -45,6 +45,9 @@ type Gui struct {
// colors of the current view.
SelBgColor, SelFgColor Attribute
// If Highlight is true, Sel{Bg,Fg}Colors will be used for the current view.
Highlight bool
// If Cursor is true then the cursor is enabled.
Cursor bool
@ -383,7 +386,7 @@ func (g *Gui) flush() error {
for _, v := range g.views {
if v.Frame {
var fgColor, bgColor Attribute
if v == g.currentView {
if g.Highlight && v == g.currentView {
fgColor = g.SelFgColor
bgColor = g.SelBgColor
} else {
@ -539,7 +542,7 @@ func (g *Gui) drawIntersections() error {
}
var fgColor, bgColor Attribute
if v == g.currentView {
if g.Highlight && v == g.currentView {
fgColor = g.SelFgColor
bgColor = g.SelBgColor
} else {