Add onSetActive callback (#2885)

Co-authored-by: taconi <igor.tacoi@protonmail.com>
This commit is contained in:
taconi 2023-08-31 13:29:07 -03:00 committed by GitHub
parent 1cbe1441aa
commit 75b9a6cefe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -1,9 +1,12 @@
package action
import (
luar "layeh.com/gopher-luar"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display"
ulua "github.com/zyedidia/micro/v2/internal/lua"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/views"
"github.com/zyedidia/tcell/v2"
@ -276,6 +279,11 @@ func (t *Tab) SetActive(i int) {
p.SetActive(false)
}
}
err := config.RunPluginFn("onSetActive", luar.New(ulua.L, MainTab().CurPane()))
if err != nil {
screen.TermMessage(err)
}
}
// GetPane returns the pane with the given split index

View file

@ -50,6 +50,8 @@ which micro defines:
* `postinit()`: initialization function called after `init()`.
* `onSetActive(bufpane)`: runs when changing the currently active panel.
* `onBufferOpen(buf)`: runs when a buffer is opened. The input contains
the buffer object.