Skip to content

Commit 765889f

Browse files
committed
Fix execution of {Spawn,Remove}MultiCursor in chained actions
- SpawnMultiCursor and RemoveMultiCursor actions change the set of cursors, so we cannot assume that it stays the same. So refresh the `cursors` list after executing every action in the chain. - If execAction() did not execute an action since it is not a multicursor, it should return true, not false, to not prevent executing next actions in the chain.
1 parent 5c8bf6b commit 765889f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/action/bufpane.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ func BufMapEvent(k Event, action string) {
150150
actionfns = append(actionfns, afn)
151151
}
152152
bufAction := func(h *BufPane, te *tcell.EventMouse) bool {
153-
cursors := h.Buf.GetCursors()
154153
success := true
155154
for i, a := range actionfns {
156155
innerSuccess := true
156+
cursors := h.Buf.GetCursors()
157157
for j, c := range cursors {
158158
if c == nil {
159159
continue
@@ -589,6 +589,9 @@ func (h *BufPane) execAction(action BufAction, name string, cursor int, te *tcel
589589

590590
return success
591591
}
592+
} else {
593+
// do nothing but return true, to not break the chain
594+
return true
592595
}
593596

594597
return false

0 commit comments

Comments
 (0)