4 "github.com/gdamore/tcell"
8 const helpTxt = `Press Ctrl-g to close help
29 Ctrl-g: Open this help screen
32 Ctrl-d: Half page down
39 Ctrl-e: Execute a command
44 'save': saves the current buffer
46 'replace "search" "value"': This will replace 'search' with 'value'.
47 Note that 'search' must be a valid regex. If one of the arguments
48 does not have any spaces in it, you may omit the quotes.
50 'set option value': sets the option to value. Please see the next section for a list of options you can set
54 Configuration directory:
56 Micro uses the $XDG_CONFIG_HOME/micro as the configuration directory. As per the XDG spec,
57 if $XDG_CONFIG_HOME is not set, ~/.config/micro is used as the config directory.
59 colorscheme: loads the colorscheme stored in $(configDir)/colorschemes/'option'.micro
60 default value: 'default'
61 Note that the default colorschemes (default, solarized, and solarized-tc) are not located in configDir,
62 because they are embedded in the micro binary
64 tabsize: sets the tab size to 'option'
67 syntax: turns syntax on or off
70 tabsToSpaces: use spaces instead of tabs
74 // DisplayHelp displays the help txt
75 // It blocks the main loop
78 _, height := screen.Size()
80 totalLines := strings.Split(helpTxt, "\n")
84 lineEnd := topline + height
85 if lineEnd > len(totalLines) {
86 lineEnd = len(totalLines)
88 lines := totalLines[topline:lineEnd]
89 for y, line := range lines {
90 for x, ch := range line {
92 screen.SetContent(x, y, ch, nil, st)
98 event := screen.PollEvent()
99 switch e := event.(type) {
100 case *tcell.EventResize:
102 case *tcell.EventKey:
109 if topline < len(totalLines)-height {
112 case tcell.KeyCtrlQ, tcell.KeyCtrlW, tcell.KeyEscape, tcell.KeyCtrlC: