Merge pull request #3261 from JoeKar/fix/command-term

action: Stop processing chained actions/commands in the moment the current `Pane` is not a `BufPane` (fix crash)
This commit is contained in:
Jöran Karl
2024-04-26 17:36:12 +02:00
committed by GitHub
3 changed files with 9 additions and 1 deletions

View File

@@ -48,7 +48,7 @@ func luaImportMicro() *lua.LTable {
ulua.L.SetField(pkg, "InfoBar", luar.New(ulua.L, action.GetInfoBar))
ulua.L.SetField(pkg, "Log", luar.New(ulua.L, log.Println))
ulua.L.SetField(pkg, "SetStatusInfoFn", luar.New(ulua.L, display.SetStatusInfoFnLua))
ulua.L.SetField(pkg, "CurPane", luar.New(ulua.L, func() action.Pane {
ulua.L.SetField(pkg, "CurPane", luar.New(ulua.L, func() *action.BufPane {
return action.MainTab().CurPane()
}))
ulua.L.SetField(pkg, "CurTab", luar.New(ulua.L, action.MainTab))

View File

@@ -169,6 +169,10 @@ func BufMapEvent(k Event, action string) {
// if the action changed the current pane, update the reference
h = MainTab().CurPane()
success = innerSuccess
if h == nil {
// stop, in case the current pane is not a BufPane
break
}
}
return true
}

View File

@@ -81,6 +81,10 @@ func (t *TermPane) SetID(i uint64) {
t.id = i
}
func (t *TermPane) Name() string {
return t.Terminal.Name()
}
func (t *TermPane) SetTab(tab *Tab) {
t.tab = tab
}