mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
fixes out of bounds error on filtered selection #7
This commit is contained in:
11
cursor.go
11
cursor.go
@@ -16,8 +16,15 @@ func NewGridCursor() *GridCursor {
|
||||
}
|
||||
}
|
||||
|
||||
func (gc *GridCursor) Len() int { return len(gc.filtered) }
|
||||
func (gc *GridCursor) Selected() *Container { return gc.filtered[gc.Idx()] }
|
||||
func (gc *GridCursor) Len() int { return len(gc.filtered) }
|
||||
|
||||
func (gc *GridCursor) Selected() *Container {
|
||||
idx := gc.Idx()
|
||||
if idx < gc.Len() {
|
||||
return gc.filtered[idx]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Refresh containers from source
|
||||
func (gc *GridCursor) RefreshContainers() (lenChanged bool) {
|
||||
|
||||
Reference in New Issue
Block a user