Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action: Stop processing chained actions/commands in the moment the current Pane is not a BufPane (fix crash) #3261

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/micro/initlua.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions internal/action/bufpane.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions internal/action/termpane.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading