better debugging output

This commit is contained in:
Jeff Carr 2025-01-29 07:55:56 -06:00
parent ce11f999f9
commit 57fbbc62ed
4 changed files with 11 additions and 8 deletions

View File

@ -30,20 +30,22 @@ func (w *guiWidget) showWidgetPlacement(s string) {
pId = w.node.Parent.WidgetId pId = w.node.Parent.WidgetId
} }
s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.node.WidgetId, pId) s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.node.WidgetId, pId)
sizeW, sizeH := w.Size()
s1 += fmt.Sprintf("size=(%2d,%2d)", sizeW, sizeH)
if w.Visible() { if w.Visible() {
sizeW, sizeH := w.Size()
s1 += fmt.Sprintf("size=(%2d,%2d)", sizeW, sizeH)
s1 += fmt.Sprintf("gocui=(%2d,%2d,%2d,%2d)", s1 += fmt.Sprintf("gocui=(%2d,%2d,%2d,%2d)",
w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1) w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
} else { } else {
sizeW, sizeH := w.Size() s1 += fmt.Sprintf(" %2s %2s %2s %2s ", "", "", "", "")
s1 += fmt.Sprintf("size=(%2d,%2d)", sizeW, sizeH)
s1 += fmt.Sprintf(" ")
} }
if w.node.Parent != nil { if w.node.Parent != nil {
if w.node.Parent.WidgetType == widget.Grid { if w.node.Parent.WidgetType == widget.Grid {
s1 += fmt.Sprintf("At(%2d,%2d) ", w.node.State.AtW, w.node.State.AtH) s1 += fmt.Sprintf("At(%2d,%2d) ", w.node.State.AtW, w.node.State.AtH)
} else {
s1 += fmt.Sprintf(" %2s %2s ", "", "")
} }
} else {
s1 += fmt.Sprintf(" %2s %2s ", "", "")
} }
tmp := "." + w.String() + ". " + w.cuiName tmp := "." + w.String() + ". " + w.cuiName
if w.node.WidgetType == widget.Box { if w.node.WidgetType == widget.Box {

View File

@ -166,8 +166,8 @@ func (w *guiWidget) realGocuiSize() *rectType {
var f func(tk *guiWidget, r *rectType) var f func(tk *guiWidget, r *rectType)
newR := new(rectType) newR := new(rectType)
// initialize the values to opposite // initialize the values to opposite
newR.w0 = 80 newR.w0 = outputW
newR.h0 = 24 newR.h0 = outputH
if me.baseGui != nil { if me.baseGui != nil {
maxW, maxH := me.baseGui.Size() maxW, maxH := me.baseGui.Size()
newR.w0 = maxW newR.w0 = maxW

View File

@ -11,7 +11,7 @@ import (
) )
var outputW int = 180 var outputW int = 180
var outputH int = 24 var outputH int = 40
func moveMsg(g *gocui.Gui) { func moveMsg(g *gocui.Gui) {
mx, my := g.MousePosition() mx, my := g.MousePosition()

View File

@ -22,6 +22,7 @@ message ViewSettings { // `autogenpb:nomutex`
message Tree { message Tree {
View parent = 1; View parent = 1;
repeated View children = 2; repeated View children = 2;
View node = 3;
} }
// this is the gocui 'view' in binary tree form // this is the gocui 'view' in binary tree form