From 765889f610150ed27812ed44d9058435258d9df4 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sat, 15 Jun 2024 20:47:59 +0200 Subject: [PATCH] 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. --- internal/action/bufpane.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/action/bufpane.go b/internal/action/bufpane.go index 14e04089..40f4379c 100644 --- a/internal/action/bufpane.go +++ b/internal/action/bufpane.go @@ -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