From e6b20b2ce92c128d8779ac63822581545fe1071c Mon Sep 17 00:00:00 2001 From: Neko Box Coder <93885501+Neko-Box-Coder@users.noreply.github.com> Date: Sat, 31 Aug 2024 11:42:55 +0100 Subject: [PATCH] Adding SpawnCursorAtLoc for plugin to use (#3441) --- internal/action/actions.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/action/actions.go b/internal/action/actions.go index cdce96d9..fc9f837d 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -1955,6 +1955,14 @@ func (h *BufPane) SpawnMultiCursor() bool { return true } +// SpawnCursorAtLoc spawns a new cursor at a location and merges the cursors +func (h *BufPane) SpawnCursorAtLoc(loc buffer.Loc) *buffer.Cursor { + c := buffer.NewCursor(h.Buf, loc) + h.Buf.AddCursor(c) + h.Buf.MergeCursors() + return c +} + // SpawnMultiCursorUpN is not an action func (h *BufPane) SpawnMultiCursorUpN(n int) bool { lastC := h.Buf.GetCursor(h.Buf.NumCursors() - 1)