mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Add CursorPageUp and CursorPageDown actions
This commit is contained in:
@@ -19,6 +19,8 @@ var helpBinding string
|
||||
var bindingActions = map[string]func(*View) bool{
|
||||
"CursorUp": (*View).CursorUp,
|
||||
"CursorDown": (*View).CursorDown,
|
||||
"CursorPageUp": (*View).CursorPageUp,
|
||||
"CursorPageDown": (*View).CursorPageDown,
|
||||
"CursorLeft": (*View).CursorLeft,
|
||||
"CursorRight": (*View).CursorRight,
|
||||
"CursorStart": (*View).CursorStart,
|
||||
@@ -884,6 +886,26 @@ func (v *View) PageDown() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// CursorPageUp places the cursor a page up
|
||||
func (v *View) CursorPageUp() bool {
|
||||
if v.Cursor.HasSelection() {
|
||||
v.Cursor.SetLoc(v.Cursor.CurSelection[0])
|
||||
v.Cursor.ResetSelection()
|
||||
}
|
||||
v.Cursor.UpN(v.height)
|
||||
return true
|
||||
}
|
||||
|
||||
// CursorPageDown places the cursor a page up
|
||||
func (v *View) CursorPageDown() bool {
|
||||
if v.Cursor.HasSelection() {
|
||||
v.Cursor.SetLoc(v.Cursor.CurSelection[1])
|
||||
v.Cursor.ResetSelection()
|
||||
}
|
||||
v.Cursor.DownN(v.height)
|
||||
return true
|
||||
}
|
||||
|
||||
// HalfPageUp scrolls the view up half a page
|
||||
func (v *View) HalfPageUp() bool {
|
||||
if v.Topline > v.height/2 {
|
||||
|
||||
Reference in New Issue
Block a user