1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-31 23:19:40 +02:00

fix panic for unprintable key presses

Checking is the associated rune of a key is printable solves our problem
of having panics whenever keys like `Home` or `Ctrl-W` are pressed.

Fixes #1175
This commit is contained in:
Francisco Miamoto 2021-03-20 20:12:17 -03:00 committed by Jesse Duffield
parent ad1468f66f
commit 7e0d48c2a1

View File

@ -1,6 +1,8 @@
package gui
import (
"unicode"
"github.com/jesseduffield/gocui"
)
@ -37,7 +39,7 @@ func (gui *Gui) commitMessageEditor(v *gocui.View, key gocui.Key, ch rune, mod g
v.EditGotoToStartOfLine()
case key == gocui.KeyCtrlE:
v.EditGotoToEndOfLine()
default:
case unicode.IsPrint(ch):
v.EditWrite(ch)
}
@ -68,7 +70,7 @@ func (gui *Gui) defaultEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.M
v.EditGotoToStartOfLine()
case key == gocui.KeyCtrlE:
v.EditGotoToEndOfLine()
default:
case unicode.IsPrint(ch):
v.EditWrite(ch)
}