Make grid sizes dynamic

The grid used static sizes which meant that changing settings didn't
have an effect on elements of the ui, notably the sidebar width. This
patch makes the `Size` parameter of a cell a function which returns the
`int`, allowing for dynamic sizes.

A `Const` function is also included for ease of use for static sizes.
This commit is contained in:
Jeffas 2020-05-31 12:37:46 +01:00 committed by Reto Brunner
parent 3877b1aa71
commit 543510f5c1
7 changed files with 115 additions and 109 deletions
widgets

View file

@ -56,11 +56,11 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger,
statusbar.Push(statusline)
grid := ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_EXACT, 1},
{ui.SIZE_WEIGHT, 1},
{ui.SIZE_EXACT, 1},
{ui.SIZE_EXACT, ui.Const(1)},
{ui.SIZE_WEIGHT, ui.Const(1)},
{ui.SIZE_EXACT, ui.Const(1)},
}).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, 1},
{ui.SIZE_WEIGHT, ui.Const(1)},
})
grid.AddChild(tabs.TabStrip)
grid.AddChild(tabs.TabContent).At(1, 0)
@ -552,7 +552,6 @@ func (aerc *Aerc) CloseDialog() {
return
}
func (aerc *Aerc) GetPassword(title string, prompt string) (chText chan string, chErr chan error) {
chText = make(chan string, 1)
chErr = make(chan error, 1)