summaryrefslogtreecommitdiff
path: root/stdoutShow.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-08 13:28:19 -0600
committerJeff Carr <[email protected]>2025-02-08 13:28:19 -0600
commitc4f9bac85eeafb4916b57d6f8953fa930d6d098e (patch)
tree065027c2d85165c2eb1c2ec14490b7b9a1dbf51c /stdoutShow.go
parent90083d5bcb2df4b526a04213c07392fe72cb816c (diff)
add config default to show stdout onscreen on start
Diffstat (limited to 'stdoutShow.go')
-rw-r--r--stdoutShow.go22
1 files changed, 19 insertions, 3 deletions
diff --git a/stdoutShow.go b/stdoutShow.go
index f74bf80..5f980bd 100644
--- a/stdoutShow.go
+++ b/stdoutShow.go
@@ -95,6 +95,13 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
me.stdout.tk.v = v
me.stdout.tk.DrawAt(me.stdout.lastW, me.stdout.lastH)
relocateStdoutOffscreen()
+ /*
+ if me.stdout.outputOffscreen {
+ me.stdout.tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
+ } else {
+ relocateStdoutOffscreen()
+ }
+ */
return v
}
@@ -135,12 +142,24 @@ func (tk *guiWidget) relocateStdout(w int, h int) {
// of functions like fmt.Fprintf, fmt.Fprintln, io.Copy, etc. Clear must
// be called to clear the view's buffer.
+func (w stdout) Write(p []byte) (n int, err error) {
+ me.writeMutex.Lock()
+ defer me.writeMutex.Unlock()
+
+ lines := strings.Split(strings.TrimSpace(string(p)), "\n")
+ me.stdout.outputS = append(me.stdout.outputS, lines...)
+
+ return len(p), nil
+}
+
func (w *guiWidget) Write(p []byte) (n int, err error) {
w.tainted = true
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...)
if tk.v == nil {
// optionally write the output to /tmp
@@ -154,9 +173,6 @@ func (w *guiWidget) Write(p []byte) (n int, err error) {
}
} else {
// display the output in the gocui window
- lines := strings.Split(strings.TrimSpace(string(p)), "\n")
- me.stdout.outputS = append(me.stdout.outputS, lines...)
-
var cur []string
// chop off the last lines in the buffer
chop := len(me.stdout.outputS) - (me.stdout.h - 1)