mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
skip offset updates in page scroll if no pages
This commit is contained in:
parent
c47ba3f804
commit
0a05007c4e
15
cursor.go
15
cursor.go
@ -143,8 +143,10 @@ func (gc *GridCursor) PgUp() {
|
||||
}
|
||||
|
||||
nextidx := int(math.Max(0.0, float64(idx-cGrid.MaxRows())))
|
||||
cGrid.Offset = int(math.Max(float64(cGrid.Offset-cGrid.MaxRows()),
|
||||
float64(0)))
|
||||
if gc.pgCount() > 0 {
|
||||
cGrid.Offset = int(math.Max(float64(cGrid.Offset-cGrid.MaxRows()),
|
||||
float64(0)))
|
||||
}
|
||||
|
||||
active := gc.filtered[idx]
|
||||
next := gc.filtered[nextidx]
|
||||
@ -163,10 +165,11 @@ func (gc *GridCursor) PgDown() {
|
||||
return
|
||||
}
|
||||
|
||||
nextidx := int(math.Min(float64(gc.Len()-1),
|
||||
float64(idx+cGrid.MaxRows())))
|
||||
cGrid.Offset = int(math.Min(float64(cGrid.Offset+cGrid.MaxRows()),
|
||||
float64(gc.Len()-cGrid.MaxRows())))
|
||||
nextidx := int(math.Min(float64(gc.Len()-1), float64(idx+cGrid.MaxRows())))
|
||||
if gc.pgCount() > 0 {
|
||||
cGrid.Offset = int(math.Min(float64(cGrid.Offset+cGrid.MaxRows()),
|
||||
float64(gc.Len()-cGrid.MaxRows())))
|
||||
}
|
||||
|
||||
active := gc.filtered[idx]
|
||||
next := gc.filtered[nextidx]
|
||||
|
Loading…
Reference in New Issue
Block a user