Highlight library entry fully

This commit is contained in:
Trevor Slocum 2020-04-25 06:55:09 -07:00
parent 7ea726e453
commit cd690d5fce
4 changed files with 27 additions and 6 deletions

2
go.mod
View file

@ -14,7 +14,7 @@ require (
github.com/mewkiz/pkg v0.0.0-20200411195739-f6b5e26764c3 // indirect
github.com/pkg/errors v0.9.1 // indirect
gitlab.com/tslocum/cbind v0.1.1
gitlab.com/tslocum/cview v1.4.5-0.20200424220521-e97629839eba
gitlab.com/tslocum/cview v1.4.5-0.20200425133514-5bfb860744af
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 // indirect
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect
golang.org/x/mobile v0.0.0-20200329125638-4c31acba0007 // indirect

4
go.sum
View file

@ -57,8 +57,8 @@ github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
gitlab.com/tslocum/cbind v0.1.1 h1:JXXtxMWHgWLvoF+QkrvcNvOQ59juy7OE1RhT7hZfdt0=
gitlab.com/tslocum/cbind v0.1.1/go.mod h1:rX7vkl0pUSg/yy427MmD1FZAf99S7WwpUlxF/qTpPqk=
gitlab.com/tslocum/cview v1.4.5-0.20200424220521-e97629839eba h1:DYq4lsxeUfkR6VYGwzWcRNJWLCgjpklNZt4HfESnyLA=
gitlab.com/tslocum/cview v1.4.5-0.20200424220521-e97629839eba/go.mod h1:85Ec3ByMemrI3tUK4Rpd8jcF3J7maOFHGwzlNnCrPVI=
gitlab.com/tslocum/cview v1.4.5-0.20200425133514-5bfb860744af h1:KFu6xaqWD4qp3rmtMD5e312r1dhgbZSxvdFoRGrO8zI=
gitlab.com/tslocum/cview v1.4.5-0.20200425133514-5bfb860744af/go.mod h1:85Ec3ByMemrI3tUK4Rpd8jcF3J7maOFHGwzlNnCrPVI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=

16
gui.go
View file

@ -73,8 +73,16 @@ func initTUI() error {
grid := cview.NewGrid().SetRows(-2, -1, 1, 1).SetColumns(-1)
mainList = cview.NewList().ShowSecondaryText(false)
queueList = cview.NewList().ShowSecondaryText(false)
mainList = cview.NewList().
ShowSecondaryText(false).
SetScrollBarVisibility(cview.ScrollBarAlways).
SetHighlightFullLine(true).
SetSelectedTextColor(tcell.ColorBlack)
queueList = cview.NewList().
ShowSecondaryText(false).
SetScrollBarVisibility(cview.ScrollBarAlways).
SetHighlightFullLine(true).
SetSelectedTextColor(tcell.ColorBlack)
topstatusbuf = cview.NewTextView().SetWrap(false).SetWordWrap(false)
bottomstatusbuf = cview.NewTextView().SetWrap(false).SetWordWrap(false)
@ -88,7 +96,9 @@ func initTUI() error {
grid.AddItem(topstatusbuf, 2, 0, 1, 1, 0, 0, false)
grid.AddItem(bottomstatusbuf, 3, 0, 1, 1, 0, 0, false)
app.SetRoot(grid, true).SetFocus(mainList)
app.SetRoot(grid, true)
focusUpdated()
return nil
}

View file

@ -4,6 +4,7 @@ import (
"path"
"time"
"github.com/gdamore/tcell"
"gitlab.com/tslocum/cview"
)
@ -237,10 +238,20 @@ func listToggleHidden() {
func toggleFocusedList() {
queueFocused = !queueFocused
focusUpdated()
}
func focusUpdated() {
if queueFocused {
app.SetFocus(queueList)
mainList.SetSelectedBackgroundColor(tcell.ColorDimGray)
queueList.SetSelectedBackgroundColor(tcell.ColorWhite)
} else {
app.SetFocus(mainList)
mainList.SetSelectedBackgroundColor(tcell.ColorWhite)
queueList.SetSelectedBackgroundColor(tcell.ColorDimGray)
}
go app.QueueUpdateDraw(updateLists)