Add onBufPaneOpen error checking (#3246)

If onBufPaneOpen callback execution fails (e.g. due to a Lua runtime
error), report this error to the user, like we do for all other Lua
callbacks, rather than silently continue working as if nothing
happened.
This commit is contained in:
Dmytro Maluka 2024-04-23 21:23:25 +02:00 committed by GitHub
parent eec068a4fc
commit e48575f349
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -290,7 +290,11 @@ func NewBufPaneFromBuf(buf *buffer.Buffer, tab *Tab) *BufPane {
func (h *BufPane) finishInitialize() {
h.initialRelocate()
h.initialized = true
config.RunPluginFn("onBufPaneOpen", luar.New(ulua.L, h))
err := config.RunPluginFn("onBufPaneOpen", luar.New(ulua.L, h))
if err != nil {
screen.TermMessage(err)
}
}
// Resize resizes the pane