try to start with STDOUT offscreen

This commit is contained in:
Jeff Carr 2025-02-06 03:28:05 -06:00
parent d2c3db7b58
commit 9c548faeda
3 changed files with 40 additions and 26 deletions

View File

@ -101,6 +101,16 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
func theStdout(g *gocui.Gui, v *gocui.View) error {
if me.stdout.outputOnTop {
if me.stdout.outputOffscreen {
me.stdout.outputOffscreen = false
log.Info("set stdout off screen here")
relocateStdoutOffscreen()
return nil
} else {
me.stdout.outputOffscreen = true
log.Info("set stdout on screen here")
}
me.stdout.tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
me.stdout.outputOnTop = false
me.baseGui.SetViewOnBottom("msg")
} else {

View File

@ -93,29 +93,6 @@ func mouseMove(g *gocui.Gui) {
}
}
func (tk *guiWidget) relocateStdout(w int, h int) {
me.stdout.lastW = w
me.stdout.lastH = h
w0 := w
h0 := h
w1 := w + me.stdout.w
h1 := h + me.stdout.h
tk.gocuiSize.w0 = w0
tk.gocuiSize.w1 = w1
tk.gocuiSize.h0 = h0
tk.gocuiSize.h1 = h1
tk.full.w0 = w0
tk.full.w1 = w1
tk.full.h0 = h0
tk.full.h1 = h1
me.baseGui.SetView("msg", w0, h0, w1, h1, 0)
me.baseGui.SetViewOnBottom("msg")
}
// this is how the window gets dragged around
func (tk *guiWidget) moveNew() {
w, h := me.baseGui.MousePosition()
@ -131,9 +108,9 @@ func (tk *guiWidget) moveNew() {
tk.dumpWidget(s)
return
} else {
newW := w - me.stdout.mouseOffsetW
newH := h - me.stdout.mouseOffsetH
tk.relocateStdout(newW, newH)
me.stdout.lastW = w - me.stdout.mouseOffsetW
me.stdout.lastH = h - me.stdout.mouseOffsetH
tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
/*
// log.Info("NOT MOVE FLAG. PASSING MOVE TO MSG", tk.node.WidgetType)
// tk.dumpWidget("moveNew() MSG" + tk.cuiName)

View File

@ -91,5 +91,32 @@ 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()
return v
}
func relocateStdoutOffscreen() {
newW := 10
newH := 0 - me.stdout.h - 4
me.stdout.tk.relocateStdout(newW, newH)
}
func (tk *guiWidget) relocateStdout(w int, h int) {
w0 := w
h0 := h
w1 := w + me.stdout.w
h1 := h + me.stdout.h
tk.gocuiSize.w0 = w0
tk.gocuiSize.w1 = w1
tk.gocuiSize.h0 = h0
tk.gocuiSize.h1 = h1
tk.full.w0 = w0
tk.full.w1 = w1
tk.full.h0 = h0
tk.full.h1 = h1
me.baseGui.SetView("msg", w0, h0, w1, h1, 0)
// me.baseGui.SetViewOnBottom("msg")
}