mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
parent
0b59a3b62f
commit
0d2667685e
@ -1,6 +1,8 @@
|
||||
package wtf
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
)
|
||||
@ -177,6 +179,17 @@ func (tracker *FocusTracker) focusables() []Wtfable {
|
||||
}
|
||||
}
|
||||
|
||||
// Sort for deterministic ordering
|
||||
sort.SliceStable(focusable[:], func(i, j int) bool {
|
||||
if focusable[i].Top() < focusable[j].Top() {
|
||||
return true
|
||||
}
|
||||
if focusable[i].Top() == focusable[j].Top() {
|
||||
return focusable[i].Left() < focusable[j].Left()
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
return focusable
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user