-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor.go
More file actions
64 lines (59 loc) · 2.33 KB
/
editor.go
File metadata and controls
64 lines (59 loc) · 2.33 KB
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
package main
import (
"fmt"
"github.com/slzatz/vimango/vim/interfaces"
)
// note that there isn't a columnOffset because currently only word wrap supported
type Editor struct {
cx, cy int //screen cursor x and y position
fc, fr int // file cursor x and y position
lineOffset int //first row based on user scroll
screenlines int //number of lines for this Editor
screencols int //number of columns for this Editor
left_margin int //can vary (so could TOP_MARGIN - will do that later
left_margin_offset int // 0 if no line numbers
top_margin int
highlight [2][2]int // [line col][line col] -> note line is 1-based not zero-based
mode Mode
vmode Mode
command_line string //for commands on the command line; string doesn't include ':'
command string // right now includes normal mode commands and command line commands
last_command string
firstVisibleRow int
highlightSyntax bool
numberLines bool
redraw bool
id int //db id of entry
//output *Output
vbuf interfaces.VimBuffer
ss []string
searchPrefix string
renderedNote string
previewLineOffset int
overlay []string // for suggest, showVimMessageLog
highlightPositions []Position
suggestions []string //spelling suggestions
bufferTick int
saveTick int
modified bool // tracks if the buffer has been modified
title string // title of the note
tabCompletion struct { // for tab completion
list []string
index int
}
normalCmds map[string]func(*Editor, int) // map of normal commands
exCmds map[string]func(*Editor) // map of ex commands
commandRegistry *CommandRegistry[func(*Editor)]
normalCommandRegistry *CommandRegistry[func(*Editor, int)]
Database *Database // pointer to the database
Session *Session // pointer to the session
Screen *Screen // pointer to the screen
}
func (e *Editor) ShowMessage(loc Location, format string, a ...interface{}) { //Sesseion struct
max_length := e.Screen.PositionMessage(loc)
str := fmt.Sprintf(format, a...)
if len(str) > max_length {
str = str[:max_length]
}
fmt.Print(str)
}