2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-05 00:00:14 +00:00

After jumping to the right page, search for the right row (#220)

This commit is contained in:
Simon Roberts 2021-10-13 18:26:12 +11:00 committed by GitHub
parent 9fa50063e0
commit b19864014e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -409,13 +409,18 @@ func (ct *Cointop) GoToPageRowIndex(idx int) error {
// GoToGlobalIndex navigates to the selected row index of all page rows
func (ct *Cointop) GoToGlobalIndex(idx int) error {
log.Debug("GoToGlobalIndex()")
log.Debugf("GoToGlobalIndex(%d)", idx)
target := ct.State.allCoins[idx]
l := ct.TableRowsLen()
atpage := idx / l
ct.SetPage(atpage)
rowIndex := idx % l
ct.HighlightRow(rowIndex)
ct.UpdateTable()
// Look for the coin in the current page
for i, coin := range ct.State.coins {
if coin == target {
ct.HighlightRow(i)
}
}
return nil
}