summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-08 14:24:43 -0600
committerJeff Carr <[email protected]>2025-02-08 14:24:43 -0600
commit58cb7f3d2d8cd102081ba545081f20bf0d6fd211 (patch)
tree5b1cb97e6c4376d2a64e1748e3ab632d460baf03
parent53eb14ccbde494a61c3b1ef6dc03edd7dd0b507e (diff)
still can't remove "msg" create in mouseMove()
-rw-r--r--eventBindings.go8
-rw-r--r--eventMouseDrag.go11
-rw-r--r--help.go6
-rw-r--r--stdoutShow.go30
4 files changed, 18 insertions, 37 deletions
diff --git a/eventBindings.go b/eventBindings.go
index 29e669c..1c0e6cc 100644
--- a/eventBindings.go
+++ b/eventBindings.go
@@ -5,7 +5,6 @@ package main
import (
"syscall"
- "time"
"github.com/awesome-gocui/gocui"
"go.wit.com/log"
@@ -72,13 +71,6 @@ func theSuperMouse(g *gocui.Gui, v *gocui.View) error {
// 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? dark =", me.dark)
- if me.clock.tk == nil {
- makeClock()
- } else {
- me.clock.tk.v.Clear()
- me.clock.tk.labelN = time.Now().Format("15:04:05")
- me.clock.tk.v.WriteString(me.clock.tk.labelN)
- }
return nil
}
diff --git a/eventMouseDrag.go b/eventMouseDrag.go
index e976d22..40f608d 100644
--- a/eventMouseDrag.go
+++ b/eventMouseDrag.go
@@ -172,14 +172,3 @@ func (tk *guiWidget) moveNew() {
// always place the help menu on top
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
}
-
-func createStdout(g *gocui.Gui) bool {
- makeOutputWidget(g, "this is a create before a mouse click")
- if me.stdout.tk != nil {
- msg := fmt.Sprintf("test out gocuiEvent() %d\n", me.ecount)
- // me.logStdout.v.Write([]byte(msg))
- me.stdout.tk.Write([]byte(msg))
- log.Log(NOW, "logStdout test out")
- }
- return true
-}
diff --git a/help.go b/help.go
index 8ae7d7b..067d841 100644
--- a/help.go
+++ b/help.go
@@ -97,6 +97,12 @@ func showHelp() error {
me.clock.tk.Hide()
me.clock.tk.Show()
}
+ if me.stdout.tk == nil {
+ makeOutputWidget(me.baseGui, "made this in showHelp()")
+ msg := fmt.Sprintf("test to stdout from in showHelp() %d\n", me.ecount)
+ me.stdout.Write([]byte(msg))
+ log.Log(NOW, "log.log(NOW) test")
+ }
return nil
}
diff --git a/stdoutShow.go b/stdoutShow.go
index 5f980bd..e630295 100644
--- a/stdoutShow.go
+++ b/stdoutShow.go
@@ -15,24 +15,15 @@ import (
"go.wit.com/widget"
)
-func showMsg(g *gocui.Gui, v *gocui.View) error {
- var l string
- var err error
-
- log.Log(NOW, "showMsg() v.name =", v.Name())
- if _, err := g.SetCurrentView(v.Name()); err != nil {
- return err
- }
-
- _, cy := v.Cursor()
- if l, err = v.Line(cy); err != nil {
- l = ""
+func createStdout(g *gocui.Gui) bool {
+ if me.stdout.tk == nil {
+ makeOutputWidget(g, "this is a create before a mouse click")
+ msg := fmt.Sprintf("test out gocuiEvent() %d\n", me.ecount)
+ // me.logStdout.v.Write([]byte(msg))
+ me.stdout.tk.Write([]byte(msg))
+ log.Log(NOW, "logStdout test out")
}
-
- outv := makeOutputWidget(g, l)
- outv.Write([]byte("test out2"))
- log.Info("test out2")
- return nil
+ return true
}
func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
@@ -157,10 +148,13 @@ func (w *guiWidget) Write(p []byte) (n int, err error) {
me.writeMutex.Lock()
defer me.writeMutex.Unlock()
- tk := me.stdout.tk
lines := strings.Split(strings.TrimSpace(string(p)), "\n")
me.stdout.outputS = append(me.stdout.outputS, lines...)
+ tk := me.stdout.tk
+ if tk == nil {
+ return len(p), nil
+ }
if tk.v == nil {
// optionally write the output to /tmp
s := fmt.Sprint(string(p))