mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
fixes out of bounds error on filtered selection #7
This commit is contained in:
parent
96b01eb3b9
commit
b2184bbc6d
@ -17,7 +17,14 @@ func NewGridCursor() *GridCursor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gc *GridCursor) Len() int { return len(gc.filtered) }
|
func (gc *GridCursor) Len() int { return len(gc.filtered) }
|
||||||
func (gc *GridCursor) Selected() *Container { return gc.filtered[gc.Idx()] }
|
|
||||||
|
func (gc *GridCursor) Selected() *Container {
|
||||||
|
idx := gc.Idx()
|
||||||
|
if idx < gc.Len() {
|
||||||
|
return gc.filtered[idx]
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Refresh containers from source
|
// Refresh containers from source
|
||||||
func (gc *GridCursor) RefreshContainers() (lenChanged bool) {
|
func (gc *GridCursor) RefreshContainers() (lenChanged bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user