add 'Esc' key to close dropdown menu
This commit is contained in:
parent
227419c1ad
commit
6045a205fd
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue