Change the help binding to Ctrl-g from Ctrl-h

This is necessary because some terminals send Backspace and Ctrl-h as
the same key, so Ctrl-h must be reserved for deleting. See #8.
This commit is contained in:
Zachary Yedidia 2016-04-18 16:28:53 -04:00
parent fdceddefe1
commit d10c401a97
4 changed files with 4 additions and 4 deletions

View file

@ -26,7 +26,7 @@ Ctrl-c: Copy
Ctrl-x: Cut
Ctrl-v: Paste
Ctrl-h: Open help
Ctrl-g: Open this help screen
Ctrl-u: Half page up
Ctrl-d: Half page down

View file

@ -197,7 +197,7 @@ func main() {
if !canceled {
HandleCommand(input, view)
}
case tcell.KeyCtrlH:
case tcell.KeyCtrlG:
DisplayHelp()
// Make sure to resize the view if the user resized the terminal while looking at the help text
view.Resize(screen.Size())

View file

@ -40,7 +40,7 @@ func (sline *Statusline) Display() {
// Add the filetype
file += " " + sline.view.buf.filetype
centerText := "Press Ctrl-h for help"
centerText := "Press Ctrl-g for help"
statusLineStyle := defStyle.Reverse(true)
if style, ok := colorscheme["statusline"]; ok {

View file

@ -394,7 +394,7 @@ func (v *View) HandleEvent(event tcell.Event) {
v.eh.Insert(v.cursor.Loc(), " ")
v.cursor.Right()
v.UpdateLines(v.cursor.y, v.cursor.y)
case tcell.KeyBackspace2:
case tcell.KeyBackspace2, tcell.KeyBackspace:
// Delete a character
if v.cursor.HasSelection() {
v.cursor.DeleteSelection()