2020-06-18 16:54:48 -04:00
|
|
|
package display
|
|
|
|
|
2020-06-23 20:07:25 -04:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/gdamore/tcell"
|
|
|
|
"gitlab.com/tslocum/cview"
|
|
|
|
)
|
2020-06-18 16:54:48 -04:00
|
|
|
|
|
|
|
var helpCells = strings.TrimSpace(`
|
|
|
|
?|Bring up this help.
|
|
|
|
Esc|Leave the help
|
|
|
|
Arrow keys, h/j/k/l|Scroll and move a page.
|
|
|
|
Tab|Navigate to the next item in a popup.
|
|
|
|
Shift-Tab|Navigate to the previous item in a popup.
|
2020-06-28 21:06:58 -04:00
|
|
|
b, Alt-Left|Go back a page
|
|
|
|
f, Alt-Right|Go forward a page
|
2020-06-18 16:54:48 -04:00
|
|
|
g|Go to top of document
|
|
|
|
G|Go to bottom of document
|
|
|
|
spacebar|Open bar at the bottom - type a URL or link number
|
|
|
|
Enter|On a page this will start link highlighting. Press Tab and Shift-Tab to pick different links. Press enter again to go to one.
|
|
|
|
Shift-NUMBER|Go to a specific tab.
|
|
|
|
Shift-0, )|Go to the last tab.
|
2020-06-23 20:07:25 -04:00
|
|
|
Ctrl-H|Go home
|
|
|
|
Ctrl-T|New tab
|
|
|
|
Ctrl-W|Close tab. For now, only the right-most tab can be closed.
|
|
|
|
Ctrl-R, R|Reload a page, discarding the cached version.
|
|
|
|
Ctrl-B|View bookmarks
|
|
|
|
Ctrl-D|Add, change, or remove a bookmark for the current page.
|
|
|
|
q, Ctrl-Q|Quit
|
2020-06-18 16:54:48 -04:00
|
|
|
`)
|
2020-06-23 20:07:25 -04:00
|
|
|
|
|
|
|
var helpTable = cview.NewTable().
|
|
|
|
SetSelectable(false, false).
|
|
|
|
SetFixed(1, 2).
|
|
|
|
SetBorders(true).
|
|
|
|
SetBordersColor(tcell.ColorGray)
|
|
|
|
|
|
|
|
// Help displays the help and keybindings.
|
|
|
|
func Help() {
|
|
|
|
helpTable.ScrollToBeginning()
|
|
|
|
tabPages.SwitchToPage("help")
|
|
|
|
App.Draw()
|
|
|
|
}
|