diff options
| author | Jeff Carr <[email protected]> | 2023-04-03 10:26:47 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-04-03 10:26:47 -0500 |
| commit | 4b6207743b90968d6b822032a4355e43b6ce6da9 (patch) | |
| tree | 2cb9f13d5e95f14e165f8e41e8484320b7454177 /toolkit/gocui/help.go | |
| parent | 0320ebe4bb49ea80761d77af80fa208157ffdb89 (diff) | |
gocui: working towards correct layout
make a gocui widget binary tree
more debugging cleanups
sample button app displays in gocui
geometry logic closer to correct
improvements in gocui layout
continued attempts to clean up tabs
dump binary tree
moving towards proper chan callback()
deprecate Widget.Name
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/gocui/help.go')
| -rw-r--r-- | toolkit/gocui/help.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/toolkit/gocui/help.go b/toolkit/gocui/help.go new file mode 100644 index 0000000..8796ad6 --- /dev/null +++ b/toolkit/gocui/help.go @@ -0,0 +1,49 @@ +// Copyright 2014 The gocui Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "errors" + "fmt" + + "github.com/awesome-gocui/gocui" +) + +func addHelp() { + me.baseGui.SetManagerFunc(helplayout) +} + +func helplayout(g *gocui.Gui) error { + var err error + maxX, _ := g.Size() + + help, err := g.SetView("help", maxX-32, 0, maxX-1, 17, 0) + if err != nil { + if !errors.Is(err, gocui.ErrUnknownView) { + return err + } + help.SelBgColor = gocui.ColorGreen + help.SelFgColor = gocui.ColorBlack + fmt.Fprintln(help, "KEYBINDINGS") + fmt.Fprintln(help, "Enter: Click Button") + fmt.Fprintln(help, "Tab/Space: Switch Buttons") + fmt.Fprintln(help, "") + fmt.Fprintln(help, "h: Help") + fmt.Fprintln(help, "Backspace: Delete Button") + fmt.Fprintln(help, "Arrow keys: Move Button") + fmt.Fprintln(help, "t: Move Button to the top") + fmt.Fprintln(help, "b: Move Button to the button") + fmt.Fprintln(help, "h: hide buttons") + fmt.Fprintln(help, "s: show buttons") + fmt.Fprintln(help, "p: panic()") + fmt.Fprintln(help, "STDOUT: /tmp/witgui.log") + fmt.Fprintln(help, "Ctrl-C or Q: Exit") + if _, err := g.SetCurrentView("help"); err != nil { + return err + } + } + me.helpLabel = help + return nil +} |
