mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
disable timed display refresh while scrolling
This commit is contained in:
parent
a48a9031cc
commit
671c944272
@ -17,6 +17,7 @@ type GridCursor struct {
|
|||||||
selectedID string // id of currently selected container
|
selectedID string // id of currently selected container
|
||||||
filtered container.Containers
|
filtered container.Containers
|
||||||
cSource connector.Connector
|
cSource connector.Connector
|
||||||
|
isScrolling bool // toggled when actively scrolling
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGridCursor(connector string) *GridCursor {
|
func NewGridCursor(connector string) *GridCursor {
|
||||||
@ -109,6 +110,9 @@ func (gc *GridCursor) ScrollPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gc *GridCursor) Up() {
|
func (gc *GridCursor) Up() {
|
||||||
|
gc.isScrolling = true
|
||||||
|
defer func() { gc.isScrolling = false }()
|
||||||
|
|
||||||
idx := gc.Idx()
|
idx := gc.Idx()
|
||||||
if idx <= 0 { // already at top
|
if idx <= 0 { // already at top
|
||||||
return
|
return
|
||||||
@ -125,6 +129,9 @@ func (gc *GridCursor) Up() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gc *GridCursor) Down() {
|
func (gc *GridCursor) Down() {
|
||||||
|
gc.isScrolling = true
|
||||||
|
defer func() { gc.isScrolling = false }()
|
||||||
|
|
||||||
idx := gc.Idx()
|
idx := gc.Idx()
|
||||||
if idx >= gc.Len()-1 { // already at bottom
|
if idx >= gc.Len()-1 { // already at bottom
|
||||||
return
|
return
|
||||||
|
3
grid.go
3
grid.go
@ -62,8 +62,11 @@ func ExpandView(c *container.Container) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func RefreshDisplay() {
|
func RefreshDisplay() {
|
||||||
|
// skip display refresh during scroll
|
||||||
|
if !cursor.isScrolling {
|
||||||
needsClear := cursor.RefreshContainers()
|
needsClear := cursor.RefreshContainers()
|
||||||
RedrawRows(needsClear)
|
RedrawRows(needsClear)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Display() bool {
|
func Display() bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user