Documentation ¶
Index ¶
- Constants
- type Buffer
- type Editor
- func (e *Editor) EditorDelChar()
- func (e *Editor) EditorDelRow(at int)
- func (e *Editor) EditorFind()
- func (e *Editor) EditorInsertChar(rch rune)
- func (e *Editor) EditorInsertNewline()
- func (e *Editor) EditorInsertRow(at int, s string)
- func (e *Editor) EditorMoveCursor(rch termbox.Key)
- func (e *Editor) EditorOpen(filename string) error
- func (e *Editor) EditorProcessEvent(ev termbox.Event)
- func (e *Editor) EditorRefreshScreen(drawCursor bool)
- func (e *Editor) EditorRowAppendString(row *erow, s string)
- func (e *Editor) EditorRowDelChar(row *erow, at int)
- func (e *Editor) EditorRowInsertChar(row *erow, at int, rch rune)
- func (e *Editor) EditorRowsToString() string
- func (e *Editor) EditorSave() error
- func (e *Editor) EditorSetStatusMessage(fm string, args ...interface{})
- func (e *Editor) EditorUpdateRow(row *erow)
- type Orzo
- type State
- type Terminal
- type TextContainer
Constants ¶
const ( KeyNull = 0 /* NULL ctrl-space set mark */ CtrlA = 1 /* Ctrl-a BOL */ CtrlB = 2 /* Ctrl-b list Buffers */ CtrlC = 3 /* Ctrl-c copy */ CtrlE = 5 /* Ctrl-e EOL */ CtrlD = 4 /* Ctrl-d del forward? */ CtrlF = 6 /* Ctrl-f find */ CtrlH = 8 /* Ctrl-h del backward*/ Tab = 9 /* Tab */ CtrlK = 11 /* Ctrl+k killToEOL */ CtrlL = 12 /* Ctrl+l redraw */ Enter = 13 /* Enter */ CtrlN = 14 /* Ctrl-n nextBuffer */ CtrlO = 15 /* Ctrl-o load(open) file */ CtrlQ = 17 /* Ctrl-q quit*/ CtrlS = 19 /* Ctrl-s save*/ CtrlU = 21 /* Ctrl-u number of times??*/ CtrlV = 22 /* Ctrl-v paste */ CtrlW = 23 /* Ctrl-w kill Buffer */ CtrlX = 24 /* Ctrl-x cut */ CtrlY = 25 /* Help */ CtrlZ = 26 /* ?? */ Esc = 27 /* Escape */ Space = 32 /* Space */ Backspace = 127 /* Backspace */ )
KEY constants
const ( ArrowLeft = termbox.KeyArrowLeft ArrowRight = termbox.KeyArrowRight ArrowUp = termbox.KeyArrowUp ArrowDown = termbox.KeyArrowDown DelKey = termbox.KeyDelete HomeKey = termbox.KeyHome EndKey = termbox.KeyEnd PageUp = termbox.KeyPgup PageDown = termbox.KeyPgdn )
Cursor movement keys
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Editor ¶
type Editor struct { Buffers []*Buffer // contains filtered or unexported fields }
func (*Editor) EditorDelChar ¶
func (e *Editor) EditorDelChar()
Delete the char at the currentLine cursor position.
func (*Editor) EditorDelRow ¶
func (*Editor) EditorFind ¶
func (e *Editor) EditorFind()
func (*Editor) EditorInsertChar ¶
Insert the specified char at the currentLine prompt position.
func (*Editor) EditorInsertNewline ¶
func (e *Editor) EditorInsertNewline()
Inserting a newline is slightly complex as we have to handle inserting a * newline in the middle of a line, splitting the line as needed.
func (*Editor) EditorInsertRow ¶
Insert a row at the specified position, shifting the other rows on the bottom * if required.
func (*Editor) EditorMoveCursor ¶
Handle cursor position change because arrow keys were pressed.
func (*Editor) EditorOpen ¶
=================== FILE OPS ============================== Load the specified text file into the current Buffer return any error
func (*Editor) EditorProcessEvent ¶
Process events arriving from the standard input, which is, the user * is typing stuff on the terminal.
func (*Editor) EditorRefreshScreen ¶
This function writes the whole screen using termbox-go
func (*Editor) EditorRowAppendString ¶
Append the string 's' at the end of a row
func (*Editor) EditorRowDelChar ¶
Delete the character at offset 'at' from the specified row.
func (*Editor) EditorRowInsertChar ¶
Insert a character at the specified position in a row, moving the remaining * runes on the right if needed.
func (*Editor) EditorRowsToString ¶
func (*Editor) EditorSave ¶
Save the currentLine file on disk. Return 0 on success, 1 on error.
func (*Editor) EditorSetStatusMessage ¶
Set an Editor status message for the second line of the status, at the * end of the screen.
func (*Editor) EditorUpdateRow ¶
func (e *Editor) EditorUpdateRow(row *erow)
Update the rendered version and the syntax highlight of a row.