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 Configuration directory:
53 Micro uses the $XDG_CONFIG_HOME/micro as the configuration directory. As per the XDG spec,
54 if $XDG_CONFIG_HOME is not set, ~/.config/micro is used as the config directory.
56 colorscheme: loads the colorscheme stored in $(configDir)/colorschemes/'option'.micro
57 default value: 'default'
58 Note that the default colorschemes (default, solarized, and solarized-tc) are not located in configDir,
59 because they are embedded in the micro binary
61 tabsize: sets the tab size to 'option'
64 syntax: turns syntax on or off
68 // DisplayHelp displays the help txt
69 // It blocks the main loop
72 _, height := screen.Size()
74 totalLines := strings.Split(helpTxt, "\n")
78 lineEnd := topline + height
79 if lineEnd > len(totalLines) {
80 lineEnd = len(totalLines)
82 lines := totalLines[topline:lineEnd]
83 for y, line := range lines {
84 for x, ch := range line {
86 screen.SetContent(x, y, ch, nil, st)
92 event := screen.PollEvent()
93 switch e := event.(type) {
94 case *tcell.EventResize:
103 if topline < len(totalLines)-height {
106 case tcell.KeyCtrlQ, tcell.KeyCtrlW, tcell.KeyEscape, tcell.KeyCtrlC: