Add event argument to onAnyEvent callback

This commit is contained in:
cutelisp 2025-06-15 02:38:27 +01:00
parent 5eddf5b85d
commit 06085865d0
2 changed files with 4 additions and 2 deletions

View File

@ -20,6 +20,8 @@ import (
isatty "github.com/mattn/go-isatty"
"github.com/micro-editor/tcell/v2"
lua "github.com/yuin/gopher-lua"
luar "layeh.com/gopher-luar"
ulua "github.com/zyedidia/micro/v2/internal/lua"
"github.com/zyedidia/micro/v2/internal/action"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/clipboard"
@ -519,7 +521,7 @@ func DoEvent() {
}
}
err := config.RunPluginFn("onAnyEvent")
err := config.RunPluginFn("onAnyEvent", luar.New(ulua.L, event))
if err != nil {
screen.TermMessage(err)
}

View File

@ -82,7 +82,7 @@ that micro defines:
* `preRune(bufpane, rune)`: runs before the composed rune will be inserted
* `onAnyEvent()`: runs when literally anything happens. It is useful for
* `onAnyEvent(event)`: runs when literally anything happens. It is useful for
detecting various changes of micro's state that cannot be detected
using other callbacks.