summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-14 03:50:59 -0600
committerJeff Carr <[email protected]>2024-11-14 03:50:59 -0600
commit2461df015375b66fb85189e90d51d63b0a5215b3 (patch)
tree1200bbf38e34a5fc2d34017edbab043450a5739e
parent368c25107a9343d3368182efbe203acb4fbf8d5e (diff)
output window works with keypress 'L'
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--keybindings.go44
1 files changed, 26 insertions, 18 deletions
diff --git a/keybindings.go b/keybindings.go
index 5cf8c2f..e1af3f0 100644
--- a/keybindings.go
+++ b/keybindings.go
@@ -134,14 +134,15 @@ func addDebugKeys(g *gocui.Gui) {
func(g *gocui.Gui, v *gocui.View) error {
me.treeRoot.ListWidgets()
- w := me.logStdout.TK.(*guiWidget)
- msg := fmt.Sprintf("test out %d\n", ecount)
- msg += fmt.Sprintf("test out %d\n", ecount)
- msg += fmt.Sprintf("test out %d\n", ecount)
- w.Write([]byte(msg + msg + msg))
- w.Write([]byte(msg + msg + msg))
- w.Write([]byte(msg + msg + msg))
- w.Write([]byte(msg + msg + msg))
+ tk := me.logStdout.TK.(*guiWidget)
+ msg := fmt.Sprintf("test out kb %d\n", ecount)
+ tk.Write([]byte(msg))
+ if tk == nil {
+ log.Log(ERROR, "tk = nil")
+ }
+ if tk.v == nil {
+ log.Log(ERROR, "tk.v = nil")
+ }
return nil
})
@@ -164,16 +165,23 @@ func addDebugKeys(g *gocui.Gui) {
// log to output window
g.SetKeybinding("", 'o', gocui.ModNone,
func(g *gocui.Gui, v *gocui.View) error {
- log.Log(ERROR, "TODO: re-implement this")
- /*
- if me.logStdout.Visible() {
- me.logStdout.SetVisible(false)
- // setOutput(os.Stdout)
- } else {
- me.logStdout.SetVisible(true)
- // setOutput(me.logStdout.tk)
- }
- */
+ log.Log(ERROR, "TODO: trying re-implement this")
+ tk := me.logStdout.TK.(*guiWidget)
+ if tk == nil {
+ log.Log(ERROR, "tk = nil")
+ }
+ if tk.v == nil {
+ log.Log(ERROR, "tk.v = nil")
+ }
+ if tk.Visible() {
+ log.Log(ERROR, "setting visible to false")
+ tk.SetVisible(false)
+ // setOutput(os.Stdout)
+ } else {
+ log.Log(ERROR, "setting visible to true")
+ tk.SetVisible(true)
+ // setOutput(me.logStdout.tk)
+ }
return nil
})