+// MoveCursorUp is not an action
+func (h *BufPane) MoveCursorUp(n int) {
+ if !h.Buf.Settings["softwrap"].(bool) {
+ h.Cursor.UpN(n)
+ } else {
+ vloc := h.VLocFromLoc(h.Cursor.Loc)
+ sloc := h.Scroll(vloc.SLoc, -n)
+ if sloc == vloc.SLoc {
+ // we are at the beginning of buffer
+ h.Cursor.Loc = h.Buf.Start()
+ h.Cursor.LastVisualX = 0
+ } else {
+ vloc.SLoc = sloc
+ vloc.VisualX = h.Cursor.LastVisualX
+ h.Cursor.Loc = h.LocFromVLoc(vloc)
+ }
+ }
+}
+
+// MoveCursorDown is not an action
+func (h *BufPane) MoveCursorDown(n int) {
+ if !h.Buf.Settings["softwrap"].(bool) {
+ h.Cursor.DownN(n)
+ } else {
+ vloc := h.VLocFromLoc(h.Cursor.Loc)
+ sloc := h.Scroll(vloc.SLoc, n)
+ if sloc == vloc.SLoc {
+ // we are at the end of buffer
+ h.Cursor.Loc = h.Buf.End()
+ vloc = h.VLocFromLoc(h.Cursor.Loc)
+ h.Cursor.LastVisualX = vloc.VisualX
+ } else {
+ vloc.SLoc = sloc
+ vloc.VisualX = h.Cursor.LastVisualX
+ h.Cursor.Loc = h.LocFromVLoc(vloc)
+ }
+ }
+}
+