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.
This commit is contained in:
Dmytro Maluka
2024-06-15 20:47:59 +02:00
parent 5c8bf6b3a6
commit 765889f610

View File

@@ -150,10 +150,10 @@ func BufMapEvent(k Event, action string) {
actionfns = append(actionfns, afn)
}
bufAction := func(h *BufPane, te *tcell.EventMouse) bool {
cursors := h.Buf.GetCursors()
success := true
for i, a := range actionfns {
innerSuccess := true
cursors := h.Buf.GetCursors()
for j, c := range cursors {
if c == nil {
continue
@@ -589,6 +589,9 @@ func (h *BufPane) execAction(action BufAction, name string, cursor int, te *tcel
return success
}
} else {
// do nothing but return true, to not break the chain
return true
}
return false