1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-06 23:46:13 +02:00

more error checks

This commit is contained in:
Dawid Dziurla 2018-08-29 14:24:04 +02:00
parent 28a9594ef7
commit 8a01d11202
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B

View File

@ -55,7 +55,9 @@ func (gui *Gui) handleHelp(g *gocui.Gui, v *gocui.View) error {
helpView, _ := g.SetView("help", maxX-x, y, x, maxY-y, 0) helpView, _ := g.SetView("help", maxX-x, y, x, maxY-y, 0)
helpView.Title = strings.Title(gui.Tr.SLocalize("help")) helpView.Title = strings.Title(gui.Tr.SLocalize("help"))
gui.renderHelpOptions(g) if err := gui.renderHelpOptions(g); err != nil {
return err
}
for _, binding := range bindings { for _, binding := range bindings {
if binding.ViewName == v.Name() && binding.Description != "" && binding.KeyReadable != "" { if binding.ViewName == v.Name() && binding.Description != "" && binding.KeyReadable != "" {
@ -69,12 +71,17 @@ func (gui *Gui) handleHelp(g *gocui.Gui, v *gocui.View) error {
content += "second\n" content += "second\n"
content += "third\n" content += "third\n"
*/ */
gui.renderString(g, "help", content)
if err := gui.renderString(g, "help", content); err != nil {
return err
}
g.Update(func(g *gocui.Gui) error { g.Update(func(g *gocui.Gui) error {
g.SetViewOnTop("help") _, err := g.SetViewOnTop("help")
gui.switchFocus(g, v, helpView) if err != nil {
return nil return err
}
return gui.switchFocus(g, v, helpView)
}) })
return nil return nil
} }