summaryrefslogtreecommitdiff
path: root/stdoutShow.go
diff options
context:
space:
mode:
Diffstat (limited to 'stdoutShow.go')
-rw-r--r--stdoutShow.go54
1 files changed, 22 insertions, 32 deletions
diff --git a/stdoutShow.go b/stdoutShow.go
index 1f6e5a6..429294c 100644
--- a/stdoutShow.go
+++ b/stdoutShow.go
@@ -4,7 +4,6 @@
package main
import (
- "errors"
"fmt"
"slices"
"strings"
@@ -46,6 +45,7 @@ func coreStdout() {
me.stdout.tk = initWidget(n)
tk := me.stdout.tk
+ tk.cuiName = "msg"
tk.gocuiSize.w0 = me.stdout.lastW
tk.gocuiSize.h0 = me.stdout.lastH
tk.gocuiSize.w1 = tk.gocuiSize.w0 + me.stdout.w
@@ -64,6 +64,9 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
return nil
}
+ me.stdout.tk.cuiName = "msg"
+ me.stdout.tk.SetView()
+
v, err := g.View("msg")
if v == nil {
// log.Log(NOW, "makeoutputwindow() this is supposed to happen. v == nil", err)
@@ -72,27 +75,7 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
return v
}
- rect := me.stdout.tk.gocuiSize
- v, err = g.SetView("msg", rect.w0, rect.h0, rect.w1, rect.h1, 0)
-
- if errors.Is(err, gocui.ErrUnknownView) {
- // log.Log(NOW, "makeoutputwindow() this is supposed to happen?", err)
- }
-
- if err != nil {
- if v == nil {
- log.Log(NOW, "makeoutputwindow() BAD: v == nil && err =", err)
- }
- log.Log(NOW, "makeoutputwindow() create output window failed", err)
- return nil
- }
-
- if v == nil {
- log.Log(NOW, "makeoutputwindow() msg == nil. WTF now? err =", err)
- return nil
- } else {
- me.stdout.tk.v = v
- }
+ v = me.stdout.tk.v
v.Clear()
v.SelBgColor = gocui.ColorCyan
@@ -101,16 +84,8 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
// g.SetViewOnBottom("msg")
// setBottomBG()
- 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
}
@@ -128,6 +103,22 @@ func relocateStdoutOffscreen() {
}
func (tk *guiWidget) relocateStdout(w int, h int) {
+ if me.stdout.w < 8 {
+ me.stdout.w = 8
+ }
+
+ if me.stdout.h < 4 {
+ me.stdout.h = 4
+ }
+
+ if w+me.stdout.w < 2 {
+ w = 2
+ }
+
+ if h+me.stdout.h < 2 {
+ h = 2
+ }
+
w0 := w
h0 := h
w1 := w + me.stdout.w
@@ -143,8 +134,7 @@ func (tk *guiWidget) relocateStdout(w int, h int) {
tk.full.h0 = h0
tk.full.h1 = h1
- me.baseGui.SetView("msg", w0, h0, w1, h1, 0)
- // me.baseGui.SetViewOnBottom("msg")
+ tk.SetView()
}
// from the gocui devs: