X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=cmd%2Fmicro%2Factions.go;h=83eec1440d82768b809879d8db588f46a847c3e9;hb=96284a1feb8c2aad02cc6927bb3581de6335246b;hp=a291c88d53e75c9f284f863b77c4bdc0f39505d6;hpb=b181342ff1117c1014323eb4bef5188b7f2ec7f4;p=micro.git diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index a291c88d..83eec144 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -1515,6 +1515,42 @@ func (v *View) PageDown(usePlugin bool) bool { return false } +// SelectPageUp selects up one page +func (v *View) SelectPageUp(usePlugin bool) bool { + if usePlugin && !PreActionCall("SelectPageUp", v) { + return false + } + + if !v.Cursor.HasSelection() { + v.Cursor.OrigSelection[0] = v.Cursor.Loc + } + v.Cursor.UpN(v.Height) + v.Cursor.SelectTo(v.Cursor.Loc) + + if usePlugin { + return PostActionCall("SelectPageUp", v) + } + return true +} + +// SelectPageDown selects down one page +func (v *View) SelectPageDown(usePlugin bool) bool { + if usePlugin && !PreActionCall("SelectPageDown", v) { + return false + } + + if !v.Cursor.HasSelection() { + v.Cursor.OrigSelection[0] = v.Cursor.Loc + } + v.Cursor.DownN(v.Height) + v.Cursor.SelectTo(v.Cursor.Loc) + + if usePlugin { + return PostActionCall("SelectPageDown", v) + } + return true +} + // CursorPageUp places the cursor a page up func (v *View) CursorPageUp(usePlugin bool) bool { if usePlugin && !PreActionCall("CursorPageUp", v) {