From e48575f3490cccb4622f7b1c51f550b7d198745c Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Tue, 23 Apr 2024 21:23:25 +0200 Subject: [PATCH] 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. --- internal/action/bufpane.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/action/bufpane.go b/internal/action/bufpane.go index cd53e688..53350b5a 100644 --- a/internal/action/bufpane.go +++ b/internal/action/bufpane.go @@ -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