-
Notifications
You must be signed in to change notification settings - Fork 1
/
help.go
74 lines (62 loc) · 1.88 KB
/
help.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package ziti
import (
"bufio"
"log"
"strings"
)
const helptext = ` ** ZITI: Help on keyboard commands
CTRL-Y: HELP
Use ArrowKeys to move Cursor around.
CTRL-S: Save the file
CTRL-Q: Quit the editor
CTRL-F: Find string in file
(ESC to exit search mode, arrows to navigate to next/prev find)
CTRL-N: Next Buffer
CTRL-B: List all the buffers
CTRL-O: (control oh) Open File into new buffer
CTRL-W: kill buffer
CTRL-Space: Set Mark
CTRL-X: Cut region from Mark to Cursor into paste buffer
CTRL-C: Copy region from Mark to Cursor into paste buffer
CTRL-V: Paste copied/cut region into file at Cursor
Once you've set the Mark, as you move the cursor,
you should be getting underlined text showing the current
selection/region.
CTRL-L: Redraw/Refresh Screen
Use Arrows to move, Home, End, and PageUp & PageDown should work
CTRL-A: Move to beginning of current line
CTRL-E: Move to end of current line
Delete: to delete a rune backward
CTRL-K: killtoEndOfLine (once) removeLine (twice)
on mac keyboards:
FN+ArrowUp: PageUp (screen full)
FN+ArrowDown: PageDown (screen full)
FN+ArrowLeft: BeginningOfFile (screen full)
FN+ArrowDown: EndOfFile (screen full)
Setting the cursor with a mouse click should work. (and so,
it should work to set the selection. but hey, you MUST SetMark
for a selection to start... sorry, it's not a real mouse based editor.)
`
func (e *editor) loadHelp() error {
ZITIHELP := "*Ziti Help*"
found, err := e.indexOfBufferNamed(ZITIHELP)
if err == nil {
e.cb = e.buffers[found]
return nil
} else {
e.addNewBuffer()
e.cb.filename = ZITIHELP
scanner := bufio.NewScanner(strings.NewReader(helptext))
for scanner.Scan() {
// does the line contain the newline?
line := scanner.Text()
e.editorInsertRow(e.cb.numrows, line)
}
if err := scanner.Err(); err != nil {
log.Fatal(err)
}
e.cb.dirty = false
e.cb.readonly = true
}
return nil
}