mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-28 22:08:12 +09:00
some additions to the plugin API
Those changes were originally used for the snippet plugin which may not be part of the core.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
dmp "github.com/sergi/go-diff/diffmatchpatch"
|
||||
"github.com/yuin/gopher-lua"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -114,6 +116,17 @@ func (eh *EventHandler) Execute(t *TextEvent) {
|
||||
eh.RedoStack = new(Stack)
|
||||
}
|
||||
eh.UndoStack.Push(t)
|
||||
|
||||
for _, pl := range loadedPlugins {
|
||||
ret, err := Call(pl+".onBeforeTextEvent", t)
|
||||
if err != nil && !strings.HasPrefix(err.Error(), "function does not exist") {
|
||||
TermMessage(err)
|
||||
}
|
||||
if val, ok := ret.(lua.LBool); ok && val == lua.LFalse {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ExecuteTextEvent(t, eh.buf)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user