diff options
| author | Jeff Carr <[email protected]> | 2025-01-31 22:56:05 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-31 22:56:05 -0600 |
| commit | a8a918655a4831c3682730fdf7fe54de98837681 (patch) | |
| tree | 2978c0bfe27cd5fa8056c91f82cfb7277110e74a /eventBindings.go | |
| parent | 39e851c76c3154390e7835e995b8aad7638d5e73 (diff) | |
add keypress '2' as a debugging tool
Diffstat (limited to 'eventBindings.go')
| -rw-r--r-- | eventBindings.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/eventBindings.go b/eventBindings.go index 5c0a599..330c255 100644 --- a/eventBindings.go +++ b/eventBindings.go @@ -9,6 +9,7 @@ import ( "github.com/awesome-gocui/gocui" "go.wit.com/log" + "go.wit.com/widget" ) // THIS IS A STANDARD. @@ -44,6 +45,7 @@ func registerHandlers(g *gocui.Gui) { g.SetKeybinding("", 'M', gocui.ModNone, dumpWidgetPlacement) // 'M' list all widgets with positions g.SetKeybinding("", 'L', gocui.ModNone, dumpWidgets) // 'L' list all widgets in tree view 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 (?) } @@ -60,6 +62,21 @@ func setSuperMouse(g *gocui.Gui, v *gocui.View) error { return nil } +// use this to test code ideas +func theNotsure(g *gocui.Gui, v *gocui.View) error { + log.Info("got keypress 2. now what?") + w, h := g.MousePosition() + for _, tk := range findByXY(w, h) { + if tk.WidgetType == widget.Stdout { + log.Info("skipping stdout") + continue + } + log.Log(GOCUI, fmt.Sprintf("findByXY() 'f' key %-8s wId=%4d at (%3d,%3d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String())) + tk.Hide() + } + return nil +} + func theHide(g *gocui.Gui, v *gocui.View) error { var w *guiWidget w = me.treeRoot.TK.(*guiWidget) |
