Fix PageUp and PageDown bindings

Fixes #72.
This commit is contained in:
Zachary Yedidia 2016-04-24 14:40:30 -04:00
parent c903e949ef
commit 1d9d0c3a4d

View file

@ -232,8 +232,8 @@ func DefaultBindings() map[string]string {
"CtrlA": "SelectAll",
"Home": "Beginning",
"End": "End",
"PageUp": "PageUp",
"PageDown": "PageDown",
"PgUp": "PageUp",
"PgDn": "PageDown",
"CtrlU": "HalfPageUp",
"CtrlD": "HalfPageDown",
"CtrlR": "ToggleRuler",
@ -589,10 +589,8 @@ func PageUp(v *View) bool {
func PageDown(v *View) bool {
if len(v.buf.lines)-(v.topline+v.height) > v.height {
v.ScrollDown(v.height)
} else {
if len(v.buf.lines) >= v.height {
v.topline = len(v.buf.lines) - v.height
}
} else if len(v.buf.lines) >= v.height {
v.topline = len(v.buf.lines) - v.height
}
return false
}