Skip to content

Commit 1c35f3d

Browse files
authored
Merge pull request zyedidia#3261 from JoeKar/fix/command-term
action: Stop processing chained actions/commands in the moment the current `Pane` is not a `BufPane` (fix crash)
2 parents ff5b147 + 07cda68 commit 1c35f3d

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

cmd/micro/initlua.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func luaImportMicro() *lua.LTable {
4848
ulua.L.SetField(pkg, "InfoBar", luar.New(ulua.L, action.GetInfoBar))
4949
ulua.L.SetField(pkg, "Log", luar.New(ulua.L, log.Println))
5050
ulua.L.SetField(pkg, "SetStatusInfoFn", luar.New(ulua.L, display.SetStatusInfoFnLua))
51-
ulua.L.SetField(pkg, "CurPane", luar.New(ulua.L, func() action.Pane {
51+
ulua.L.SetField(pkg, "CurPane", luar.New(ulua.L, func() *action.BufPane {
5252
return action.MainTab().CurPane()
5353
}))
5454
ulua.L.SetField(pkg, "CurTab", luar.New(ulua.L, action.MainTab))

internal/action/bufpane.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ func BufMapEvent(k Event, action string) {
169169
// if the action changed the current pane, update the reference
170170
h = MainTab().CurPane()
171171
success = innerSuccess
172+
if h == nil {
173+
// stop, in case the current pane is not a BufPane
174+
break
175+
}
172176
}
173177
return true
174178
}

internal/action/termpane.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ func (t *TermPane) SetID(i uint64) {
8181
t.id = i
8282
}
8383

84+
func (t *TermPane) Name() string {
85+
return t.Terminal.Name()
86+
}
87+
8488
func (t *TermPane) SetTab(tab *Tab) {
8589
t.tab = tab
8690
}

0 commit comments

Comments
 (0)