fix search index

Former-commit-id: e3c36d1892bb05eef95507f6cce65af341ee7969 [formerly e3c36d1892bb05eef95507f6cce65af341ee7969 [formerly 60a11172f4c866fc3c1794927e9fce4ee1608743 [formerly b6acefb9d23b8471d37fd71c8938c3f154096bea]]]
Former-commit-id: b4ac65fafe6c9298ad97bf4769fb1307bcd17f90
Former-commit-id: b40fb8dd58c3bad0dcfb44a6e4ac5602e01981dc [formerly dc0843fc4b8c4e510e51ab6866af307a8ef65763]
Former-commit-id: 8b8c76503269afeda421c9f4679a76e7d0ba33cf
pull/15/head
Miguel Mota 6 years ago
parent 342697d0af
commit 1497efdffe

@ -24,8 +24,20 @@ func (ct *Cointop) setPage(page int) int {
}
func (ct *Cointop) highlightRow(idx int) error {
ct.tableview.SetOrigin(0, 0)
ct.tableview.SetCursor(0, 0)
ox, _ := ct.tableview.Origin()
cx, _ := ct.tableview.Cursor()
ct.tableview.SetCursor(cx, idx)
_, sy := ct.tableview.Size()
perpage := ct.getTotalPerPage()
p := idx % perpage
oy := (p / sy) * sy
cy := p % sy
if oy > 0 {
ct.tableview.SetOrigin(ox, oy)
}
ct.tableview.SetCursor(cx, cy)
return nil
}

@ -40,7 +40,14 @@ func (ct *Cointop) search(q string) error {
q = strings.TrimSpace(strings.ToLower(q))
for i := range ct.allcoins {
coin := ct.allcoins[i]
if strings.ToLower(coin.Name) == q || strings.ToLower(coin.Symbol) == q {
if strings.ToLower(coin.Name) == q {
ct.goToGlobalIndex(i)
return nil
}
}
for i := range ct.allcoins {
coin := ct.allcoins[i]
if strings.ToLower(coin.Symbol) == q {
ct.goToGlobalIndex(i)
return nil
}

Loading…
Cancel
Save