diff options
| author | Jeff Carr <[email protected]> | 2025-02-08 13:57:31 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-08 13:57:31 -0600 |
| commit | 5827b9ace289a645be2189c12865f05f59a25fca (patch) | |
| tree | a7e127192f41f5588a29bab43850c6932c360e74 | |
| parent | c4f9bac85eeafb4916b57d6f8953fa930d6d098e (diff) | |
buttons in dense mode line up correctly
| -rw-r--r-- | colorNew.go | 8 | ||||
| -rw-r--r-- | place.go | 3 | ||||
| -rw-r--r-- | size.go | 19 |
3 files changed, 26 insertions, 4 deletions
diff --git a/colorNew.go b/colorNew.go index b7b908b..3357178 100644 --- a/colorNew.go +++ b/colorNew.go @@ -99,10 +99,10 @@ func (tk *guiWidget) setColorButtonDense() { return } tk.color.frame = gocui.AttrNone - tk.color.fg = gocui.ColorBlue - tk.color.bg = gocui.AttrNone - tk.color.selFg = gocui.ColorWhite - tk.color.selBg = gocui.ColorBlue + tk.color.fg = gocui.ColorWhite + tk.color.bg = gocui.ColorBlue + tk.color.selFg = gocui.ColorBlue + tk.color.selBg = gocui.AttrNone } func (tk *guiWidget) setColorButton() { @@ -148,6 +148,9 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) { tk.color = nil tk.defaultColor = nil tk.setColorButtonDense() + // if tk.full.Height() > 0 { + tk.full.h1 = tk.full.h0 + // } } tk.gocuiSetWH(startW, startH) return tk.gocuiSize.Width(), tk.gocuiSize.Height() @@ -79,6 +79,11 @@ func (tk *guiWidget) Size() (int, int) { return len(tk.String()) + 10, 3 // TODO: compute this based on 'window dense' case widget.Checkbox: return len(tk.String()) + 2, 3 // TODO: compute this based on 'window dense' + case widget.Button: + if tk.isWindowDense() { + return len(tk.String()) + 2, 0 + } + return len(tk.String()) + 2, 3 // TODO: compute this based on 'window dense' } if tk.isFake { return 0, 0 @@ -249,6 +254,14 @@ func (tk *guiWidget) setFullSize() bool { tk.full.h1 = r.h1 changed = true } + if tk.node.WidgetType == widget.Button { + tk.full.h1 = tk.full.h0 + 1 + } + if tk.isWindowDense() && tk.isInGrid() { + // if tk.full.Height() > 0 { + tk.full.h1 = tk.full.h0 + // } + } if changed { tk.dumpWidget(fmt.Sprintf("setFullSize(changed)")) } @@ -310,6 +323,12 @@ func (tk *guiWidget) buttonFullSize() rectType { tk.full.h0 = r.h0 tk.full.h1 = r.h1 + // total hack. fix this somewhere eventually correctly + if tk.isWindowDense() { // total hack. fix this somewhere eventually correctly + tk.full.h0 += 1 // total hack. fix this somewhere eventually correctly + tk.full.h1 = tk.full.h0 // total hack. fix this somewhere eventually correctly + } + return r } |
