summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Roberts <lyricnz@users.noreply.github.com>2021-10-13 18:26:12 +1100
committerGitHub <noreply@github.com>2021-10-13 18:26:12 +1100
commitb19864014e8ccb2df318e9716d02f06f6e264c48 (patch)
treeff507f618c513e137203a4b26cb267c4a2dc2758
parent9fa50063e0c92db1fc1903801bb00370bf5be752 (diff)
After jumping to the right page, search for the right row (#220)
-rw-r--r--cointop/navigation.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/cointop/navigation.go b/cointop/navigation.go
index abbd2be..6c8fe65 100644
--- a/cointop/navigation.go
+++ b/cointop/navigation.go
@@ -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
}