mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-02 23:27:32 +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:
parent
ad1468f66f
commit
7e0d48c2a1
@ -1,6 +1,8 @@
|
|||||||
package gui
|
package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"unicode"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,7 +39,7 @@ func (gui *Gui) commitMessageEditor(v *gocui.View, key gocui.Key, ch rune, mod g
|
|||||||
v.EditGotoToStartOfLine()
|
v.EditGotoToStartOfLine()
|
||||||
case key == gocui.KeyCtrlE:
|
case key == gocui.KeyCtrlE:
|
||||||
v.EditGotoToEndOfLine()
|
v.EditGotoToEndOfLine()
|
||||||
default:
|
case unicode.IsPrint(ch):
|
||||||
v.EditWrite(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()
|
v.EditGotoToStartOfLine()
|
||||||
case key == gocui.KeyCtrlE:
|
case key == gocui.KeyCtrlE:
|
||||||
v.EditGotoToEndOfLine()
|
v.EditGotoToEndOfLine()
|
||||||
default:
|
case unicode.IsPrint(ch):
|
||||||
v.EditWrite(ch)
|
v.EditWrite(ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user