Add bindings for Home and End keys

See #21
This commit is contained in:
Zachary Yedidia
2016-04-18 14:02:39 -04:00
parent c7f8584d84
commit 84d353838c
3 changed files with 11 additions and 0 deletions

View File

@@ -33,6 +33,9 @@ Ctrl-d: Half page down
PageUp: Page up
PageDown: Page down
Home: Go to beginning
End: Go to end
Ctrl-e: Execute a command
Possible commands:

View File

@@ -485,6 +485,12 @@ func (v *View) HandleEvent(event tcell.Event) {
v.OpenFile()
// Rehighlight the entire buffer
v.UpdateLines(v.topline, v.topline+v.height)
case tcell.KeyHome:
v.topline = 0
relocate = false
case tcell.KeyEnd:
v.topline = len(v.buf.lines) - 1 - v.height
relocate = false
case tcell.KeyPgUp:
v.PageUp()
relocate = false