]> git.lizzy.rs Git - micro.git/commitdiff
Allow plugins to create view types
authorZachary Yedidia <zyedidia@gmail.com>
Sun, 3 Dec 2017 20:15:07 +0000 (15:15 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Sun, 3 Dec 2017 20:15:07 +0000 (15:15 -0500)
Closes #904

cmd/micro/micro.go
cmd/micro/view.go

index b74cf672620318197816958c536dff645594f605..275f58ce9fc0f96cd8a5ebfef208b9952820fed0 100644 (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))
index 5bab40bdf52a664214ddcdaaa63d9e1d065e9674..d20ef3ce4b9fbff71f68aba52b9195449d335554 100644 (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}