disable timed display refresh while scrolling

This commit is contained in:
Bradley Cicenas 2017-06-12 13:52:45 +00:00
parent a48a9031cc
commit 671c944272
2 changed files with 15 additions and 5 deletions

View File

@ -17,6 +17,7 @@ type GridCursor struct {
selectedID string // id of currently selected container
filtered container.Containers
cSource connector.Connector
isScrolling bool // toggled when actively scrolling
}
func NewGridCursor(connector string) *GridCursor {
@ -109,6 +110,9 @@ func (gc *GridCursor) ScrollPage() {
}
func (gc *GridCursor) Up() {
gc.isScrolling = true
defer func() { gc.isScrolling = false }()
idx := gc.Idx()
if idx <= 0 { // already at top
return
@ -125,6 +129,9 @@ func (gc *GridCursor) Up() {
}
func (gc *GridCursor) Down() {
gc.isScrolling = true
defer func() { gc.isScrolling = false }()
idx := gc.Idx()
if idx >= gc.Len()-1 { // already at bottom
return

View File

@ -62,9 +62,12 @@ func ExpandView(c *container.Container) {
}
func RefreshDisplay() {
// skip display refresh during scroll
if !cursor.isScrolling {
needsClear := cursor.RefreshContainers()
RedrawRows(needsClear)
}
}
func Display() bool {
var menu func()