~abyxcos/hatemail

1b76ab85316b5f09fd953ced51b63a0ca16375e4 — abyxcos 4 years ago 308841a master
Use a multi-line string for the help message.
1 files changed, 20 insertions(+), 2 deletions(-)

M hatemail.go
M hatemail.go => hatemail.go +20 -2
@@ 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