diff options
| author | Jeff Carr <[email protected]> | 2025-02-06 02:15:21 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-06 02:15:21 -0600 |
| commit | 3faacd6c43e451847af8143a0c58bfd95535478d (patch) | |
| tree | e1b8b5da33f39e48bad51b8739f10cec80c1032b /eventBindings.go | |
| parent | 31c130045d903b3c874dbf8728589a6a909704ae (diff) | |
nicer help menu & stdout behavior
Diffstat (limited to 'eventBindings.go')
| -rw-r--r-- | eventBindings.go | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/eventBindings.go b/eventBindings.go index 02339af..157902f 100644 --- a/eventBindings.go +++ b/eventBindings.go @@ -32,25 +32,23 @@ func registerHandlers(g *gocui.Gui) { g.SetKeybinding("", keyForced, modForced, handle_ctrl_z) // CTRL-Z :cleverly let's you background gocui (breaks cursor mouse on return) // regular keys - g.SetKeybinding("", '?', gocui.ModNone, theHelp) // '?' toggles on and off the help menu - g.SetKeybinding("", 'w', gocui.ModNone, doWindow) // 'w' close all windows - g.SetKeybinding("", 'r', gocui.ModNone, widgetRefresh) // 'r' screen refresh - g.SetKeybinding("", 'q', gocui.ModNone, doExit) // 'q' exit + g.SetKeybinding("", 'H', gocui.ModNone, theHelp) // '?' toggles on and off the help menu + g.SetKeybinding("", 'O', gocui.ModNone, theStdout) // 'o' toggle the STDOUT window + g.SetKeybinding("", 'q', gocui.ModNone, doExit) // 'q' exit // debugging - g.SetKeybinding("", 'f', gocui.ModNone, theFind) // 'f' shows what is under your mouse - g.SetKeybinding("", 'S', gocui.ModNone, setSuperMouse) // 'S' Super Mouse mode! - g.SetKeybinding("", 'h', gocui.ModNone, theHide) // 'h' hide all widgets + g.SetKeybinding("", '2', gocui.ModNone, theNotsure) // '2' use this to test new ideas + g.SetKeybinding("", 'S', gocui.ModNone, theSuperMouse) // 'S' Super Mouse mode! g.SetKeybinding("", 'M', gocui.ModNone, printWidgetPlacements) // 'M' list all widgets with positions g.SetKeybinding("", 'L', gocui.ModNone, printWidgetTree) // 'L' list all widgets in tree view + g.SetKeybinding("", 'f', gocui.ModNone, theFind) // 'f' shows what is under your mouse g.SetKeybinding("", 'd', gocui.ModNone, theLetterD) // 'd' toggles on and off debugging buttons - g.SetKeybinding("", '2', gocui.ModNone, theNotsure) // '2' for testing new ideas g.SetKeybinding("", 'q', gocui.ModNone, quit) // 'q' only exits gocui. plugin stays alive (?) } -// flips on 'super mouse' mode +// flips on 'super mouse' mode // this was awesome for debugging gocui. never remove this code. // while this is turned on, it will print out every widget found under the mouse -func setSuperMouse(g *gocui.Gui, v *gocui.View) error { +func theSuperMouse(g *gocui.Gui, v *gocui.View) error { if me.supermouse { log.Log(GOCUI, "supermouse off") me.supermouse = false @@ -93,18 +91,22 @@ func addDropdown() *tree.Node { return addDropdownNew(-222) } -// use this to test code ideas +// use this to test code ideas // put whatever you want here and hit '2' to activate it func theNotsure(g *gocui.Gui, v *gocui.View) error { log.Info("got keypress 2. now what?") // w, h := g.MousePosition() - me.newWindowTrigger <- true + // me.newWindowTrigger <- true return nil } -func theHide(g *gocui.Gui, v *gocui.View) error { - var w *guiWidget - w = me.treeRoot.TK.(*guiWidget) - w.hideWidgets() +func theStdout(g *gocui.Gui, v *gocui.View) error { + if me.outputOnTop { + me.outputOnTop = false + me.baseGui.SetViewOnBottom("msg") + } else { + me.outputOnTop = true + me.baseGui.SetViewOnTop("msg") + } return nil } @@ -173,16 +175,6 @@ func theHelp(g *gocui.Gui, v *gocui.View) error { return nil } -func widgetRefresh(g *gocui.Gui, v *gocui.View) error { - log.Log(GOCUI, "todo: refresh windows here") - return nil -} - -func doWindow(g *gocui.Gui, v *gocui.View) error { - log.Log(GOCUI, "todo: close all windows here") - return nil -} - // todo: find and give credit to the person that I found this patch in their forked repo // handle ctrl+z func handle_ctrl_z(g *gocui.Gui, v *gocui.View) error { |
