diff --git a/eventBindings.go b/eventBindings.go index b4bcf3e..ad6330f 100644 --- a/eventBindings.go +++ b/eventBindings.go @@ -29,6 +29,7 @@ func registerHandlers(g *gocui.Gui) { g.SetKeybinding("", gocui.KeyCtrlD, gocui.ModNone, openDebuggger) // CTRL-D : open the (D)ebugger keyForced, modForced := gocui.MustParse("ctrl+z") // setup ctrl+z g.SetKeybinding("", keyForced, modForced, handle_ctrl_z) // CTRL-Z :cleverly let's you background gocui (breaks cursor mouse on return) + g.SetKeybinding("", gocui.KeyEsc, gocui.ModNone, doEsc) // escape key // regular keys g.SetKeybinding("", 'H', gocui.ModNone, theHelp) // 'H' toggles on and off the help menu @@ -122,6 +123,16 @@ func tabCycleWindows(g *gocui.Gui, v *gocui.View) error { return nil } +func doEsc(g *gocui.Gui, v *gocui.View) error { + log.Info("got escape key") + if me.dropdown.active { + me.dropdown.tk.Hide() + me.dropdown.active = false + log.Info("escaped from dropdown") + } + return nil +} + func theShow(g *gocui.Gui, v *gocui.View) error { var w *guiWidget w = me.treeRoot.TK.(*guiWidget)