2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-10 13:10:26 +00:00

navigate to first line key

Former-commit-id: 8e07c53091aaedc14c5b182c2cacd71c276e5dc1 [formerly 8e07c53091aaedc14c5b182c2cacd71c276e5dc1 [formerly 29d16c7850911eeb7b6176549ce360cbe8d6d4e5 [formerly 4f0eb30606]]]
Former-commit-id: 64a7e2711686acb92c839a3686e660b7da1f1868
Former-commit-id: 552c724fd03747b28061e4fbadc94fb4c364da56 [formerly 496eb3582bf878a4358328afe3d443d56b1a3136]
Former-commit-id: 3f9df39ce0e2afacc76e2c03ad33ec5102f3a2c9
This commit is contained in:
Miguel Mota 2018-04-03 16:35:30 -07:00
parent eb684cdb71
commit 3705319ab3
3 changed files with 18 additions and 0 deletions

View File

@ -69,6 +69,7 @@ Key|Action
<kbd>2</kbd>|sort by *[2]4 hour change*
<kbd>7</kbd>|sort by *[7] day change*
<kbd>a</kbd>|sort by *[a]vailable supply*
<kbd>g</kbd>|navigate to first line
<kbd>G</kbd>|navigate to last line
<kbd>h</kbd>|alias to previous page
<kbd>j</kbd>|alias to navigate down

View File

@ -38,6 +38,7 @@ func (ct *Cointop) keybindings(g *gocui.Gui) error {
ct.setKeybinding('2', ct.sortfn("24hchange", true))
ct.setKeybinding('7', ct.sortfn("7dchange", true))
ct.setKeybinding('a', ct.sortfn("availablesupply", true))
ct.setKeybinding('g', ct.navigateFirstLine)
ct.setKeybinding('G', ct.navigateLastLine)
ct.setKeybinding('h', ct.prevPage)
ct.setKeybinding('j', ct.cursorDown)

View File

@ -91,6 +91,22 @@ func (ct *Cointop) pageUp(g *gocui.Gui, v *gocui.View) error {
return nil
}
func (ct *Cointop) navigateFirstLine(g *gocui.Gui, v *gocui.View) error {
if ct.tableview == nil {
return nil
}
ox, _ := ct.tableview.Origin()
cx, _ := ct.tableview.Cursor()
if err := ct.tableview.SetOrigin(ox, 0); err != nil {
return err
}
if err := ct.tableview.SetCursor(cx, 0); err != nil {
return err
}
ct.rowChanged()
return nil
}
func (ct *Cointop) navigateLastLine(g *gocui.Gui, v *gocui.View) error {
if ct.tableview == nil {
return nil