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

Change "0" to go to top coin on first page (#218)

* Add new action move_to_first_page_first_row which goes to the first coin on the first page. Bind to "0" by default, replacing first_page
This commit is contained in:
Simon Roberts 2021-10-13 18:38:11 +11:00 committed by GitHub
parent 27ad1a782d
commit 68fd858304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 2 deletions

View File

@ -4,6 +4,7 @@ package cointop
func ActionsMap() map[string]bool {
return map[string]bool{
"first_page": true,
"move_to_first_page_first_row": true,
"help": true,
"toggle_show_help": true,
"close_help": true,

View File

@ -36,7 +36,7 @@ func DefaultShortcuts() map[string]string {
"alt+right": "sort_right_column",
"F1": "help",
"F5": "refresh",
"0": "first_page",
"0": "move_to_first_page_first_row",
"1": "sort_column_1h_change",
"2": "sort_column_24h_change",
"3": "sort_column_30d_change",

View File

@ -218,6 +218,8 @@ func (ct *Cointop) SetKeybindingAction(shortcutKey string, action string) error
view = "help"
case "first_page":
fn = ct.Keyfn(ct.FirstPage)
case "move_to_first_page_first_row":
fn = ct.Keyfn(ct.NavigateToFirstPageFirstRow)
case "sort_column_1h_change":
fn = ct.Sortfn("1h_change", true)
case "sort_column_24h_change":

View File

@ -309,6 +309,13 @@ func (ct *Cointop) PrevPageTop() error {
return nil
}
// NavigateToFirstPageFirstRow navigates to the first row on the first page
func (ct *Cointop) NavigateToFirstPageFirstRow() error {
log.Debug("TopCoin()")
ct.GoToGlobalIndex(0)
return nil
}
// FirstPage navigates to the first page
func (ct *Cointop) FirstPage() error {
log.Debug("FirstPage()")

View File

@ -46,7 +46,7 @@ refresh_rate = 60
[shortcuts]
"$" = "last_page"
0 = "first_page"
0 = "move_to_first_page_first_row"
1 = "sort_column_1h_change"
2 = "sort_column_24h_change"
7 = "sort_column_7d_change"
@ -133,6 +133,7 @@ Action|Description
----|------|
`first_chart_range`|Select first chart date range (e.g. 24H)
`first_page`|Go to first page
`move_to_first_page_first_row`|Go to first row on the first page
`enlarge_chart`|Increase chart height
`help`|Show help
`hide_currency_convert_menu`|Hide currency convert menu