@@ 18,6 18,24 @@ var (
emailBody *tview.TextView
)
+func helpMessage() string {
+ return `Keys:
+ Global:
+ q - quit
+ ? - this help message
+
+ Lists:
+ j/k - up/down one message
+ g/G - top/bottom of list
+ h/l - change panes
+ o - open an email
+
+ Email:
+ esc - close an email
+`
+
+}
+
func eventHandler(ev *tcell.EventKey) *tcell.EventKey {
// Some global keys that function in every context
// Just stop if we find a CtrlC
@@ 65,7 83,7 @@ func eventHandler(ev *tcell.EventKey) *tcell.EventKey {
}
case "help":
switch {
- case ev.Key() == tcell.KeyEsc:
+ case ev.Key() == tcell.KeyEsc || ev.Rune() == '?' || ev.Rune() == 'q':
pages.HidePage("help")
}
}
@@ 125,7 143,7 @@ func main() {
SetColumns(0).
SetBorders(true)
helpText := tview.NewTextView().
- SetText("q - quit\nj/k - up and down list\nh/l - change active list\no - open message\nesc - close message\n? - this help page")
+ SetText(helpMessage())
help.AddItem(helpText, 0, 0, 1, 1, 0, 0, true)
// Piece the app together