mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-15 21:37:09 +09:00
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:
@@ -150,10 +150,10 @@ func BufMapEvent(k Event, action string) {
|
|||||||
actionfns = append(actionfns, afn)
|
actionfns = append(actionfns, afn)
|
||||||
}
|
}
|
||||||
bufAction := func(h *BufPane, te *tcell.EventMouse) bool {
|
bufAction := func(h *BufPane, te *tcell.EventMouse) bool {
|
||||||
cursors := h.Buf.GetCursors()
|
|
||||||
success := true
|
success := true
|
||||||
for i, a := range actionfns {
|
for i, a := range actionfns {
|
||||||
innerSuccess := true
|
innerSuccess := true
|
||||||
|
cursors := h.Buf.GetCursors()
|
||||||
for j, c := range cursors {
|
for j, c := range cursors {
|
||||||
if c == nil {
|
if c == nil {
|
||||||
continue
|
continue
|
||||||
@@ -589,6 +589,9 @@ func (h *BufPane) execAction(action BufAction, name string, cursor int, te *tcel
|
|||||||
|
|
||||||
return success
|
return success
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// do nothing but return true, to not break the chain
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user