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

Change default key binding "0" to be "go to first coin" not "go to first page" #217

Closed lyricnz closed 2 years ago

lyricnz commented 2 years ago

Making "0" go to the top coin on the first page would be a more useful binding, to help "reset" from deep in the coin list.

vuon9 commented 2 years ago

What about still go to first page by 0, but if the page is 0 then go to top? I think it still benefits. 😀

Scenarios:

  1. Given being in 2nd page, when I press 0, then it goes to the first page.
  2. Given being in 1st page, when I press 0, then it goes to the first index of first page.

Sample code:

// cointop/navigation.go
func (ct *Cointop) FirstPage() error {
    log.Debug("FirstPage()")

    // return if already at the first page
    if ct.IsFirstPage() {
        ct.NavigateFirstLine() // just add it
        return nil
    }

    ct.State.page = 0
    ct.UpdateTable()
    ct.RowChanged()
    return nil
}
lyricnz commented 2 years ago

That sound like a reasonable "hidden special feature" for the first page action. Would like to still have the "top coin" action to do it in one - perhaps we can find a new keybinding for one of them? "0" sounds (to the computer nerd in me) like goto-top.

vuon9 commented 2 years ago

I just concern if it could be less shortcuts to be memorized. But I think that's also good to separate keys as your point.

lyricnz commented 2 years ago

Thanks for getting involved, @vuon9 !

simon-anz commented 2 years ago

How much use is it to go from (say) [page 12, row 9] back to [page 1, row 9]. How much does the "9" mean, on a completely different page? I'm feeling like "0" is a "reset".

lyricnz commented 2 years ago

Renamed and merged.