summaryrefslogtreecommitdiff
path: root/stdoutShow.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-08 18:21:31 -0600
committerJeff Carr <[email protected]>2025-02-08 18:21:31 -0600
commitbff0943dc51dde0545b9e1a1515df06c44017d70 (patch)
tree809c0615672e660ce0c6e5bfa19a2dfeb1d4cab5 /stdoutShow.go
parent2c07da350a3bc9ee48d32a93f96c645d85690436 (diff)
keep cleaning the 'msg' stdout handling code
Diffstat (limited to 'stdoutShow.go')
-rw-r--r--stdoutShow.go48
1 files changed, 29 insertions, 19 deletions
diff --git a/stdoutShow.go b/stdoutShow.go
index e630295..5e3b305 100644
--- a/stdoutShow.go
+++ b/stdoutShow.go
@@ -156,32 +156,42 @@ func (w *guiWidget) Write(p []byte) (n int, err error) {
return len(p), nil
}
if tk.v == nil {
- // optionally write the output to /tmp
- s := fmt.Sprint(string(p))
- s = strings.TrimSuffix(s, "\n")
- fmt.Fprintln(outf, s)
v, _ := me.baseGui.View("msg")
if v != nil {
// fmt.Fprintln(outf, "found msg")
tk.v = v
}
- } else {
- // display the output in the gocui window
- var cur []string
- // chop off the last lines in the buffer
- chop := len(me.stdout.outputS) - (me.stdout.h - 1)
- if chop < 0 {
- chop = 0
- }
- if len(me.stdout.outputS) > chop {
- cur = append(cur, me.stdout.outputS[chop:]...)
+ return len(p), nil
+ }
+ tk.refreshStdout()
+ /*
+ // optionally write the output to /tmp
+ s := fmt.Sprint(string(p))
+ s = strings.TrimSuffix(s, "\n")
+ fmt.Fprintln(outf, s)
+ v, _ := me.baseGui.View("msg")
+ if v != nil {
+ // fmt.Fprintln(outf, "found msg")
+ tk.v = v
+ }
} else {
- cur = append(cur, me.stdout.outputS...)
+ // display the output in the gocui window
+ var cur []string
+ // chop off the last lines in the buffer
+ chop := len(me.stdout.outputS) - (me.stdout.h - 1)
+ if chop < 0 {
+ chop = 0
+ }
+ if len(me.stdout.outputS) > chop {
+ cur = append(cur, me.stdout.outputS[chop:]...)
+ } else {
+ cur = append(cur, me.stdout.outputS...)
+ }
+ slices.Reverse(cur)
+ tk.v.Clear()
+ fmt.Fprintln(tk.v, strings.Join(cur, "\n"))
}
- slices.Reverse(cur)
- tk.v.Clear()
- fmt.Fprintln(tk.v, strings.Join(cur, "\n"))
- }
+ */
return len(p), nil
}