diff --git a/_demos/demo1.go b/_demos/demo1.go index ac69be9..eacff36 100644 --- a/_demos/demo1.go +++ b/_demos/demo1.go @@ -38,6 +38,10 @@ func layout(g *gocui.Gui) error { return nil } +func quit(g *gocui.Gui, v *gocui.View) error { + return gocui.ErrorQuit +} + func main() { var err error @@ -49,6 +53,10 @@ func main() { g.Layout = layout + if err := g.SetKeybinding("", gocui.KeyCtrlC, 0, quit); err != nil { + log.Panicln(err) + } + err = g.MainLoop() if err != nil && err != gocui.ErrorQuit { log.Panicln(err) diff --git a/_demos/demo3.go b/_demos/demo3.go index 3b70df6..94efa6c 100644 --- a/_demos/demo3.go +++ b/_demos/demo3.go @@ -20,6 +20,10 @@ func layout(g *gocui.Gui) error { return nil } +func quit(g *gocui.Gui, v *gocui.View) error { + return gocui.ErrorQuit +} + func main() { var err error @@ -31,6 +35,10 @@ func main() { g.Layout = layout + if err := g.SetKeybinding("", gocui.KeyCtrlC, 0, quit); err != nil { + log.Panicln(err) + } + err = g.MainLoop() if err != nil && err != gocui.ErrorQuit { log.Panicln(err)