From 84d353838ced331b5e4c3c86eca4795b4fd80553 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Mon, 18 Apr 2016 14:02:39 -0400 Subject: [PATCH] Add bindings for Home and End keys See #21 --- README.md | 2 ++ cmd/micro/help.go | 3 +++ cmd/micro/view.go | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 3c44c2ae..e4db8ab7 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,8 @@ You can move the cursor around with the arrow keys and mouse. * Ctrl-d: Half page down * PageUp: Page up * PageDown: Page down +* Home: Go to beginning +* End: Go to end * Ctrl-e: Execute a command You can also use the mouse to manipulate the text. Simply clicking and dragging will select text. You can also double click diff --git a/cmd/micro/help.go b/cmd/micro/help.go index dfeff02f..b1ef8b65 100644 --- a/cmd/micro/help.go +++ b/cmd/micro/help.go @@ -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: diff --git a/cmd/micro/view.go b/cmd/micro/view.go index dbbd663a..84dd4cd4 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -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