cointop-sh / cointop

A fast and lightweight interactive terminal based UI application for tracking cryptocurrencies 🚀
https://cointop.sh
Apache License 2.0
3.98k stars 311 forks source link

Sometimes search goes to the wrong place #215

Closed lyricnz closed 2 years ago

lyricnz commented 2 years ago

I think it goes to the right page but not the right row - depending on current sort order.

To reproduce:

  1. start cointop
  2. change sort order to name
  3. search for "XYZ"
  4. cointop shows a coin on page 8 (currently Cardstack CARD) BUG
  5. switch sort order to symbol, scroll to near bottom, confirm that coin XYZ is there
lyricnz commented 2 years ago

Looking at the code in navigation.go https://github.com/cointop-sh/cointop/blob/master/cointop/navigation.go#L411 it looks like GoToGlobalIndex(idx int) uses div/mod to figure out which row to highlight, but the coins are not globally sorted by the current search criteria (only the current page is)

lyricnz commented 2 years ago

https://user-images.githubusercontent.com/122371/136855992-c14907d1-2d1b-4d79-ab8f-8142e80e3275.mov