Update demos with keybindings

This commit is contained in:
Roi Martin (@nibble_ds) 2014-01-06 01:23:18 +01:00
parent 0c57f28caa
commit 425741d93e
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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)