summaryrefslogtreecommitdiff
path: root/stdoutShow.go
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 /stdoutShow.go
parent53eb14ccbde494a61c3b1ef6dc03edd7dd0b507e (diff)
still can't remove "msg" create in mouseMove()
Diffstat (limited to 'stdoutShow.go')
-rw-r--r--stdoutShow.go30
1 files changed, 12 insertions, 18 deletions
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))