diff --git a/internal/action/actions.go b/internal/action/actions.go index 2ea8f472..54982957 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -2060,37 +2060,20 @@ func (h *BufPane) SpawnCursorAtLoc(loc buffer.Loc) *buffer.Cursor { // SpawnMultiCursorUpN is not an action func (h *BufPane) SpawnMultiCursorUpN(n int) bool { lastC := h.Buf.GetCursor(h.Buf.NumCursors() - 1) - var c *buffer.Cursor - if !h.Buf.Settings["softwrap"].(bool) { - if n > 0 && lastC.Y == 0 { - return false - } - if n < 0 && lastC.Y+1 == h.Buf.LinesNum() { - return false - } - - h.Buf.DeselectCursors() - - c = buffer.NewCursor(h.Buf, buffer.Loc{lastC.X, lastC.Y - n}) - c.LastVisualX = lastC.LastVisualX - c.LastWrappedVisualX = lastC.LastWrappedVisualX - c.X = c.GetCharPosInLine(h.Buf.LineBytes(c.Y), c.LastVisualX) - c.Relocate() - } else { - vloc := h.VLocFromLoc(lastC.Loc) - sloc := h.Scroll(vloc.SLoc, -n) - if sloc == vloc.SLoc { - return false - } - - h.Buf.DeselectCursors() - - vloc.SLoc = sloc - vloc.VisualX = lastC.LastWrappedVisualX - c = buffer.NewCursor(h.Buf, h.LocFromVLoc(vloc)) - c.LastVisualX = lastC.LastVisualX - c.LastWrappedVisualX = lastC.LastWrappedVisualX + if n > 0 && lastC.Y == 0 { + return false } + if n < 0 && lastC.Y+1 == h.Buf.LinesNum() { + return false + } + + h.Buf.DeselectCursors() + + c := buffer.NewCursor(h.Buf, buffer.Loc{lastC.X, lastC.Y - n}) + c.LastVisualX = lastC.LastVisualX + c.LastWrappedVisualX = lastC.LastWrappedVisualX + c.X = c.GetCharPosInLine(h.Buf.LineBytes(c.Y), c.LastVisualX) + c.Relocate() h.Buf.AddCursor(c) h.Buf.SetCurCursor(h.Buf.NumCursors() - 1)