Allow plugins to create view types

Closes #904
This commit is contained in:
Zachary Yedidia 2017-12-03 15:15:07 -05:00
parent e0a8e90ad9
commit 98778a80c2
2 changed files with 6 additions and 0 deletions

View file

@ -403,6 +403,7 @@ func main() {
L.SetGlobal("Reload", luar.New(L, LoadAll))
L.SetGlobal("ByteOffset", luar.New(L, ByteOffset))
L.SetGlobal("ToCharPos", luar.New(L, ToCharPos))
L.SetGlobal("NewViewType", luar.New(L, NewViewType))
// Used for asynchronous jobs
L.SetGlobal("JobStart", luar.New(L, JobStart))

View file

@ -18,6 +18,11 @@ type ViewType struct {
scratch bool // The file cannot be saved
}
// NewViewType creates a new ViewType - useful for plugins
func NewViewType(kind int, readonly, scratch bool) ViewType {
return ViewType{kind, readonly, scratch}
}
var (
vtDefault = ViewType{0, false, false}
vtHelp = ViewType{1, true, true}