4 "github.com/gdamore/tcell"
8 const helpTxt = `Press Ctrl-q to quit help
32 Ctrl-d: Half page down
36 Ctrl-e: Execute a command
41 'save': saves the current buffer
43 'replace "search" "value"': This will replace 'search' with 'value'.
44 Note that 'search' must be a valid regex. If one of the arguments
45 does not have any spaces in it, you may omit the quotes.
47 'set option value': sets the option to value. Please see the next section for a list of options you can set
51 colorscheme: loads the colorscheme stored in ~/.micro/colorschemes/'option'.micro
52 default value: 'default'
54 tabsize: sets the tab size to 'option'
57 syntax: turns syntax on or off
61 // DisplayHelp displays the help txt
62 // It blocks the main loop
65 _, height := screen.Size()
67 totalLines := strings.Split(helpTxt, "\n")
71 lineEnd := topline + height
72 if lineEnd > len(totalLines) {
73 lineEnd = len(totalLines)
75 lines := totalLines[topline:lineEnd]
76 for y, line := range lines {
77 for x, ch := range line {
79 screen.SetContent(x, y, ch, nil, st)
85 event := screen.PollEvent()
86 switch e := event.(type) {
87 case *tcell.EventResize:
96 if topline < len(totalLines)-height {
99 case tcell.KeyCtrlQ, tcell.KeyCtrlW, tcell.KeyEscape, tcell.KeyCtrlC: