trying to fix padding

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-29 23:39:33 -06:00
parent d58eee556c
commit cbc579e93a
7 changed files with 28 additions and 10 deletions

View File

@ -124,7 +124,7 @@ func (w *guiWidget) doWidgetClick() {
w.placeWidgets(3, 2)
w.showWidgets()
w.hideFake()
hideFake()
showDebug = true
w.dumpTree("after")

View File

@ -50,13 +50,11 @@ func addDebugKeys(g *gocui.Gui) {
func(g *gocui.Gui, v *gocui.View) error {
fakeStartWidth = me.FakeW
fakeStartHeight = me.TabH + me.FramePadH
var w *guiWidget
w = me.treeRoot.TK.(*guiWidget)
if showDebug {
w.showFake()
showFake()
showDebug = false
} else {
w.hideFake()
hideFake()
showDebug = true
}
return nil

View File

@ -19,6 +19,8 @@ func init() {
// init the config struct default values
Set(&me, "default")
// Set(&me, "dense")
me.myTree = tree.New()
me.myTree.PluginName = "gocui"
me.myTree.ActionFromChannel = action

View File

@ -77,7 +77,7 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
tk.dumpTree("start place")
newW := startW + me.GroupPadW
newH := startH + 3 // normal hight of the group label
newH := startH + 1 // normal hight of the group label
var maxW int = 0
// now move all the children aka: run place() on them
for _, child := range tk.children {

View File

@ -43,7 +43,7 @@ func (tk *guiWidget) Size() (int, int) {
maxW = sizeW
}
}
return maxW, maxH
return maxW + me.GroupPadW, maxH
}
if tk.isFake {
return 0, 0
@ -75,7 +75,7 @@ func (w *guiWidget) sizeGrid() (int, int) {
for _, h := range w.heights {
totalH += h
}
return totalW, totalH
return totalW + me.GridPadW, totalH
}
func (tk *guiWidget) sizeBox() (int, int) {
@ -99,5 +99,5 @@ func (tk *guiWidget) sizeBox() (int, int) {
}
}
}
return maxW, maxH
return maxW + me.BoxPadW, maxH
}

View File

@ -76,7 +76,13 @@ type config struct {
TabPadW int `default:"4" dense:"0"`
// additional amount of space to indent on a group
GroupPadW int `default:"6" dense:"2"`
GroupPadW int `default:"4" dense:"1"`
// additional amount of space to indent on a group
BoxPadW int `default:"2" dense:"1"`
// additional amount of space to indent on a group
GridPadW int `default:"2" dense:"1"`
// the raw beginning of each window (or tab)
RawW int `default:"1"`

12
view.go
View File

@ -184,6 +184,18 @@ func (w *guiWidget) hideWidgets() {
}
}
func hideFake() {
var w *guiWidget
w = me.treeRoot.TK.(*guiWidget)
w.hideFake()
}
func showFake() {
var w *guiWidget
w = me.treeRoot.TK.(*guiWidget)
w.showFake()
}
func (w *guiWidget) hideFake() {
if w.isFake {
w.hideView()