summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Roberts <lyricnz@users.noreply.github.com>2021-10-13 18:38:11 +1100
committerGitHub <noreply@github.com>2021-10-13 18:38:11 +1100
commit68fd85830448e3f4721a47d0658642eca01e2bca (patch)
treeca0fd0f51626816ac7e943cac3e811b51aaaf0fa
parent27ad1a782d367aa0304153ed6fe6317f6b7afdd8 (diff)
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
-rw-r--r--cointop/actions.go1
-rw-r--r--cointop/default_shortcuts.go2
-rw-r--r--cointop/keybindings.go2
-rw-r--r--cointop/navigation.go7
-rw-r--r--docs/content/config.md3
5 files changed, 13 insertions, 2 deletions
diff --git a/cointop/actions.go b/cointop/actions.go
index 53f098b..a00fce0 100644
--- a/cointop/actions.go
+++ b/cointop/actions.go
@@ -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,
diff --git a/cointop/default_shortcuts.go b/cointop/default_shortcuts.go
index 8dc8ff1..261885d 100644
--- a/cointop/default_shortcuts.go
+++ b/cointop/default_shortcuts.go
@@ -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",
diff --git a/cointop/keybindings.go b/cointop/keybindings.go
index 2f0b6b3..5e6b865 100644
--- a/cointop/keybindings.go
+++ b/cointop/keybindings.go
@@ -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":
diff --git a/cointop/navigation.go b/cointop/navigation.go
index 6c8fe65..e5b4b2e 100644
--- a/cointop/navigation.go
+++ b/cointop/navigation.go
@@ -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()")
diff --git a/docs/content/config.md b/docs/content/config.md
index 6c6dac2..8570449 100644
--- a/docs/content/config.md
+++ b/docs/content/config.md
@@ -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